You are here: Re: 2 text alignment on the same line « HTML « IT news, forums, messages
Re: 2 text alignment on the same line

Posted by Andy Dingley on 10/02/42 11:55

Neredbojias wrote:

> > I try below, but it does not work. It has 'left text' and 'right text'
> > next to each other:
> > <span style="color:purple" align="left">left text</span><span
> > style="color:green" align="right">right text</span> <br/>
> >
> > And I try not to use Table or css float to achieve that.
>
> Must use float or absolute positioning.

"Float" doesn't itself control text alignment, and it would be
misleading to imply so.

Inline elements won't render the CSS text-align property
http://www.w3.org/TR/CSS21/text.html#alignment-prop

To make them do so, you have to change their display property, so that
their internal content is rendered as a block. There are two ways to do
this.

Ideally we'd set "display: inline-block;" which does just what we want.
Unfortunately browser support is unusably low for this as yet.

So instead we have to use "display: block;" instead. This works fine,
except that it sets the "outside" behaviour of the element to be block
as well -- we have to counteract that by adding the floats.



> Also, this:
> <span style="color:purple" align="left">
> is invalid. Should be:
> <span style="background:inherit;color:purple;text-align:left;">...

Why is that invalid ? It's _obsolete_ perhaps, but it's not invalid.
Invalid has a definite technical meaning, and this isn't it.

Also what useful purpose does setting background-color: inherit; have,
other than to turn off a validator warning message ?

 

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

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