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 John Hosking on 01/11/07 11:44

Johnny wrote:

[Please don't top-post. - John]

> Adrienne Boswell wrote:
>
>>Gazing into my crystal ball I observed "Johnny" <johnnylee194@gmail.com>
>>writing in news:1168496741.406019.138990@77g2000hsv.googlegroups.com:
>>
>>
>>>I have the following code:
>>>
>>><p style="text-align: center">center-text<br/>
>>><i style="text-align: right">right-text</i></p>
>>>
>>>but the right-text doesn't align to right as expected. Could anybody
>>>help me out?
>>>
>>
>>P is a block element, I is inline.
>>

> Do you mean that if an inline element is contained in a block element,
> the "text-align" won't take effect?
>

No, but you have to think about what you are asking for. Picture this: A
*paragraph* is a blocky kind of thing (to use very loose terminology...)
and so it can make sense to want text within it to be aligned to one
side or another (or centered or justified). But the *I element* is
inline, and not blocky. What part of the inline bit do you want to
enlarge so that the text within it aligns to the other side?

RTFM: http://www.w3.org/TR/CSS21/text.html#alignment-prop

"'text-align'... describes how inline content of a block is aligned."

HTH
--
John

 

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

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