|
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]
|