Re: Margins in Netscape

Gray Jonathan-AJG003C wrote:
> 
> Assigning margins in the style sheet to the body tag.
> 
> body,  {
>         background: #FFFFFF;
>         color : #000000;
>         font-family : Arial,Helvetica, sans-serif;
>         font-size: 9pt;
>         margin-left : 5%;
>         margin-right : 5%;
> }
> 
> Is there a workaround to get the margins to be assigned in netscape. ?

Remove the superfluous comma. element_name {property: value} is the
standard syntax for assigning styles to elements.

Netscape makes some effort to implement the ignoring rules, which state
that where any part of selector is invalid the associated block should
be ignored; unfortunately this is a bug in its code. See:

http://www.w3.org/TR/REC-CSS2/grammar.html

ruleset
  : selector [ ',' S* selector ]*
    '{' S* declaration [ ';' S* declaration ]* '}' S*
  ;
selector
  : simple_selector [ combinator simple_selector ]*
  ;

simple_selector
  : element_name? [ HASH | class | attrib | pseudo ]* S*
  ;

element_name
  : IDENT | '*'
  ;


Note how simple_selector is element_name? (i.e. zero or one) plus [...]*
(i.e. zero or more), rather than what it probably should have been:

simple_selector
  : [element_name | [ HASH | class | attrib | pseudo ]] [ HASH | class |
attrib | pseudo ]* S*
  ;

in other words, although '' (an empty string) is technically valid,
Netscape does not realise that this so, and therefore ignores the block.

Incidentally, this is a useful workaround for Netscape, and one I
personally use: e.g., http://richinstyle.com/bugs/table.html 

H1, {font-size: 28px; /* Netscape doesn't like font-size very much */

line-height: 34px; /* It's not too keen on line-height either */

font-weight: bold} 


and:

H1 {netscape: @away {}; /* That's got rid of most of them */

font-size: 28px;

line-height: 34px;

font-weight: bold}



and:

@ie3 must(die);

H1, {margin: 22px 0} /* It's not really very good at handling margins
either - this is read by IE */


and also:

@ie3 must(die);

H1 {netscape: @away {}; /* Opera has a bug so it ignores 'h1,' so I
duplicate things; IE can't cope with the @away {}*/

margin: 22px 0} 


(yes I know that this is not valid, and neither is the doctpye (strict
in a transitional page - put in to save me from those awful bug modes))

Such tricks are documented at:

http://richinstyle.com/masterclass/crossbrowser.html
-----------------------------------
Please visit http://RichInStyle.com. Featuring:
MySite: customizable styles.         AlwaysWork style 
Browser bug table covering all CSS2 with links to descriptions.
Lists of > 1000 browser bugs         Websafe Colorizer 
CSS2, CSS1 and HTML4 tutorials.      CSS masterclass 
CSS2 test suite: 5000++ tests and 300+ test pages.

Received on Thursday, 3 August 2000 08:56:57 UTC