Style sheet issue

Take a look at the following snippet of my .css file.

<STYLE TYPE="text/javascript">
with (tags.body) {
  marginTop="-10pt";
  marginLeft="-10pt";
  marginRight="-10pt";
  }
</STYLE>

<STYLE TYPE="text/css">
body {margin:0pt;
      //margin-top:0px;
      background-color:white;
      background-repeat:repeat-n;
      }
</style>

See the line //margin-top:0px;  If I uncomment it, or even remove it, the margin goes back to 10 in NN.  As long as I leave it as is, everything is fine.  Any ideas why the // tells the NN browser to ignore this line?  Whereas we know IE will ignore the <STYLE TYPE="text/javascript"> entries.  My thinking is that as long as NN is goint to procees the javascript code first, it will ignore the other entries.  It doesn't explain the //margin... line though.  Does NN ignore or discard anystyle properties tagged with //?  Try it with a simple image or table.  If you need the entire code let me know, it's nothing fancy, just plain html stuff
LVL 18
mgfranzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

clockwatcherCommented:
Netscape appears to discard the entire style sheet if it's got invalid syntax which throwing the // in there does.

For example, you'll get the same results if you do something like this:


<STYLE TYPE="text/javascript">
with (tags.body) {
  marginTop="-10pt";
  marginLeft="-10pt";
  marginRight="-10pt";
  }
</STYLE>

<STYLE TYPE="text/css">
body {margin:0pt;
margin-top:0px;
background-color:green;
background-repeat:repeat-n;
this line is not supposed to be here
}
</style>

<html>
<body>
Hello
</body>
</html>
0
mgfranzAuthor Commented:
Hmmm... thats a though, although in IE the results are correct whether I have the // on a line or the "this line is not suppose to be here" input.  So I can suppose that in IE all styles tags are processed except a non-style, and in NN if a non-style is found, discard all the properties of that object.
0
clockwatcherCommented:
I think I'd just say it's a different parsing philosophy.  IE seems to ignore what it doesn't understand and Netscape seems to throw out what it doesn't understand.  IE has always been more forgiving of syntax than Netscape.

Netscape doesn't just ignore the style, if it's got a javascript entry first.  If you've got a syntactically valid statement, Netscape has no problem working with both.

E.g.,

<STYLE TYPE="text/javascript">
with (tags.body) {
  marginTop="-10pt";
  marginLeft="-10pt";
  marginRight="-10pt";
  }
</STYLE>

<STYLE TYPE="text/css">

body {
background-color:green;
}

</style>

<html>
<body>
Hello
</body>
</html>
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

clockwatcherCommented:
If you really want to account for the style sheet differences, use the javascript section after the normal style sheet.  IE will ignore it; Netscape will replace the attribute's set in the first definition with those defined in the second.

<STYLE TYPE="text/css">
body {margin:0pt;
margin-top:0px;
background-color:white;
background-repeat:repeat-n;
}
</style>

<STYLE TYPE="text/javascript">
with (tags.body) {
  marginTop="-10pt";
  marginLeft="-10pt";
  marginRight="-10pt";
  }
</STYLE>

<html>
<body>
Hello
</body>
</html>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JaguwarCommented:
Actually, // is a commented line and will be ignored in both browsers.

More importantly, there are noticeable differences between IE and Netscape in the space they leave all around the edge of your screen.  Here's a much simpler solution:

Get rid of all the CSS that refers to placement, (I'm assuming you're attempting to use the entire window space, right up to the edge, right?) and edit your body tag like this:

<body topmargin=0 leftmargin=0 marginehigt=0 marginwidth=0>

This will work in both browsers.  

HTH!

Jaguwar
0
mgfranzAuthor Commented:
Wrong Jag, please try your suggestions before you post an answer.  I know being new to the EE group is an honor to you, but please.  It is proper etiquite to post a comment unless you are absolutely sure your answer will solve the problem.  The // is not a comment tag in a style sheet, in JavaScript yes, but there are no comments allowed in style sheets, other than the standard <!-- -->

Besides, with your solution, all you would need is the <body style='margin:0'> tag.
0
JaguwarCommented:
Oops on the //, my bad.  I've been reading too many questions I think. :-)

Haven't tried what you suggested, glad to learn something even as I make a booboo! :-)

Jaguwar
0
mgfranzAuthor Commented:
Tha's why were here... :-)
0
clockwatcherCommented:
Personally, I'm here for the free t-shirts.  ;-)

That reminds me-- I've got to sign up as someone new now that I've hit the limit.
0
mgfranzAuthor Commented:
..Snicker... ;-)

Speaking of which...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.