You are here: Re: Why this "text-align" doesn't work? « HTML « IT news, forums, messages
Re: Why this "text-align" doesn't work?

Posted by Jukka K. Korpela on 01/11/07 12:36

Scripsit Andy Dingley:

> Johnny wrote:
>
>> Do you mean that if an inline element is contained in a block
>> element, the "text-align" won't take effect?
>
> How could it? What does "alignment" mean to something that's inline
> and thus doesn't have the right sort of "box" to align things into?

Of course it _could_. An inline element _could_ have a width wider than
needed for its content, and its content might be aligned within that box.

CSS specifications simply say that text-align does not apply to inline
elements (i.e., you _can_ setting text-align for an inline element, but the
setting has no effect). That's it. Trying to explain the reasons is probably
futile at best and confusing at worst.

> You probably need to use two block elements here (<p> or <div>). Then
> to add a float to keep them on the same line.

To set two different alignments, you need two block elements (in the CSS
sense). We don't know about the real situation to make an informed decision
on suitable markup (only a dummy example was shown), but it's a good guess
that either <p> followed by <div> or two <div> elements should be used. If
you use <p> followed by <div> and you dont't want spacing between them, you
should set margin-bottom: 0 for the <p> element.

> This is just the vague hand-waving version of course and Jukka will
> probably swoop down out of his tree in a minute to criticise our
> incorrect punctuation and bad taste in shirts. _Sometimes_ he posts a
> useful explanation too, but sadly rarely.

You seem to wish to reduce the average usefulness of _your_ posts by
including stupid personal attacks that any sensible 8-year old or older
child would be ashamed of.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация