<style> works only in the explorer and not in netscape

Posted on 2000-04-16
Last Modified: 2010-04-09
I run a servlet which creates a html page:

"<html><head><title>Order Form</title>"+
"<center><b>Order Status</b></center>"+
"<table border = 1>"+
"<style TYPE=\"text/css\" >"+
"TABLE { font-size : 9pt;"+
      "color : blue}"+
"TH { font-size : 9pt;"+
"font-weight : bold}"+
                                          "<body text=\"000000\" bgcolor=\"ffffff\">"+
                                          "<tr>" + etc, etc, (filling the table with records)

in the internet explorer there's no problem, the table appears exactly as i want but in netscape, the table doesn't appear with the same style and it is also empty, with no records in it.                        

can you tell me what's wrong with the code?                                                                  
Question by:twg
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1

Expert Comment

ID: 2720331
You have this line:
"<table border = 1>"+
in the header.  That shouldn't be there.  Maybe it's causing the problem?

Also you should try to put end of lines in the file.  Netscape may be confused by that as well.  What you showed has no enod of lines and will result in one long line of text.


Author Comment

ID: 2720452
thanks Josh.
I removed the line <table border=1> and it didn't help.
where do you think I have to put end of lines?
while filling the table with data of after every html line?

Expert Comment

ID: 2720625
NS is VERY fussy about creating tables.  You MUST have (in the final table)


In particular, leaving out the <table> or </table> tags will abort the display of the table completely (NS MAY forgive not closing <td>s or <tr>s)

If you are very careful about how your table is created by your applet, you should not have a problem.  IE is much more forgiving about these (and other) HTML issues.

Check your HTML code once the page is generated.  I am sure you will discover that one or more of the required tags are missing.  All the code will be there in NS; it just will not render.

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.


Accepted Solution

astevens earned 30 total points
ID: 2720984
I decided to test a few of the earlier suggestions.  
I created a page using the same styles as in your example and , additionally, decided to leave out the closing </th> and </td> tags.  Finally, I put all of the markup on one line.  Netscape 4.7 on my windows machine had no problems with this.

I hope this saves you some time.


<html><head><title>Order Form</title> <style TYPE=text/css > TABLE {  font-size : 18pt; color: blue; } TH { font-size : 9pt; font-weight : bold; } td {color:blue ; font-size:9pt;}</style></head><body bgcolor="ffffff"><table> <tr><th>head</tr><tr><td>cell</tr></table></body></html>


Expert Comment

ID: 2721053
Well, I guess the EOLs won't be important for styles then since astevens said it worked for him.  NOrmally with tables it's not a problem either, but the spacing may differ when no EOLs or white space are found between tags.  It should at least load though, even if the spacing is slightly different.

The opening/closing tags do tend to plague NN though as TTom said.  Sometimes it works ok, like in astevens case, and sometimes it does not.  I looked at your code again and noticed no opening <TABLE> tag.  That is very important as is the closing table tag.  The other tags it can deal with sometimes, unless you get complicated nested table structures (it gets even pickier).

Good luck!

Expert Comment

ID: 2722833
I think Josh hit the nail on the head with his initial comment (although not quite completely explained).  Putting the <table> tag above the body of the document probably made it "invisible" to the browser.  In NS, this will abort the rendering of the table.

The simple answer is to move the point at which the <table> tag is inserted to BELOW the <body> tag.

That's what I was getting at with my original comment.


Author Comment

ID: 2725471
Thanks everyone. I did some changes and finally it worked out.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question