Re: text-align behavior

On Thu, 4 Sep 2003 15:40:03 -0500, Browning, Glen J ERDC-ITL-MS Contractor 
<Glen.J.Browning@erdc.usace.army.mil> wrote:

> I am using the tsWebEditor, which uses the TidyLib, and I am seeing a 
> behavior which I don't understand. The following line of HTML code:
>
> <hr align="left">
>
> gets replaced with
>
> <hr class="c1">
>
> where c1 is defined as
>
> hr.c1 {text-align: left;}
>
> This works fine in IE, but in Netscape, the hr returns to it's default 
> center alignment. Apparently, Netscape doesn't recognize the text-align 
> as applying to anything but text.

Which Netscape are you talking about? If you test with Netscape 4, you 
should not be surprised at anything.

Without a value for 'width' set, I wouldn't expect any visible effect of 
aligning HR. If I also add a width, I can confirm thaat Netscape 7/Mozilla 
does indeed not align the rule (not even in Quirks rendering mode), while 
MSIE 6 and Opera do.

> Of course, I know of several ways to force this to do what I want, but 
> what is the "officially recommended" method for aligning something like 
> this using CSS.

It could be argued that the proper CSS should instead be:

   hr.c1 {margin-left: auto; margin-right: auto;}

It depends on whether you see the line that is drawn as inline content of 
the HR element, or more like a collapsed border of the element. Or as 
something that transcend all categories. The style above works in Mozilla, 
but has no effect on MSIE 6 and Opera (even in Standards mode rendering).

So a cross-browser solution would be:

   hr.c1 {margin-left: auto; margin-right: auto; text-align: left;}


... but I'm not sure if Tidy should be changed in such a way.


-- 
The Web is a procrastination apparatus:  |  Rijk van Geijtenbeek
It can absorb as much time as            |   Documentation & QA
is required to ensure that you           |  mailto:rijk@opera.com M
won't get any real work done.  - J.Nielsen

Received on Friday, 5 September 2003 04:40:44 UTC