<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
  • 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.

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Hover Gone 16 31
Centering a div in html5 5 47
how to get responsive video to always be centered 15 37
Bootstrap Datable Spinner 3 31
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now