Connecting Tech Pros Worldwide Help | Site Map

CSS Border only showing in IE6, not FireFox 3, Opera

Moderator
 
Join Date: Mar 2006
Posts: 1,103
#1: Oct 16 '08
I seem to be missing the borders from div.level1 and div.level2 when viewed in FireFox or Opera. Simplified version of the code.
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <HTML>
  4.     <head>
  5.         <title>Useful Links</title>
  6.         <style type="text/css">
  7.                     body{background-color: #000000;
  8.                             margin:0px;
  9.                             border:0px;
  10.                             padding:10px;}
  11.                     div.level1 {border: medium double rgb(200,200,200)
  12.                                   margin: 0px;
  13.                                   padding:10px;}
  14.                     h1        {font-size:150%;
  15.                                 color: #0000FF;
  16.                                 margin:0px;
  17.                                 border:0px;
  18.                                 padding:0px;}
  19.                     div.level2 {padding:0px, 10px;
  20.                                   border: medium groove rgb(111,111,111)
  21.                                   margin: 0px;}
  22.                     h2        {font-size:130%;
  23.                                 color: #11EE11;
  24.                                 margin:0px;
  25.                                 border:0px;
  26.                                 padding:0px;}
  27.                     div.link {margin:3px, 10px;}
  28.  
  29.                     a            {font-weight: bold;}
  30.                     a:link     {color: #FFFFFF;}
  31.                     a:visited     {color: #FFFFFF;}
  32.                     a:hover     {color: #0000FF;}
  33.                     a:active     {color: #FF0000;}
  34.                     a.new     {font-size: 60%;}
  35.  
  36.                 </style>
  37.     </head>
  38.     <body>
  39.         <div class="level1">
  40.             <h1>Admin</h1>
  41.             <div class="level2">
  42.                 <h2>Applications</h2>
  43.                 <div class="link"><a href="http://www.google.ca" class="main">Google</a>  <a href="http://www.google.ca" target="_blank" class="new">New Window</a></div>
  44.             </div>
  45.         </div>
  46.     </body>
  47. </HTML>
  48.  
Am I declaring border styles incorrectly? Mostly just copied examples from w3schools.

Versions used:
IE 6.0 sp2
Firefox 3.0.3
Opera 9.5.1
lgiuliari's Avatar
Newbie
 
Join Date: Oct 2008
Posts: 27
#2: Oct 16 '08

re: CSS Border only showing in IE6, not FireFox 3, Opera


I'm no expert but after a quick look I noticed you forgot to add a semicoln after your borders in the declaration.

Expand|Select|Wrap|Line Numbers
  1.  <?xml version="1.0" encoding="UTF-8"?> 
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
  3. <HTML> 
  4.     <head> 
  5.         <title>Useful Links</title> 
  6.         <style type="text/css"> 
  7.                     body{background-color: #000000; 
  8.                             margin:0px; 
  9.                             border:0px; 
  10.                             padding:10px;} 
  11.                     div.level1 {border: medium double rgb(200,200,200);
  12.                                   margin: 0px; 
  13.                                   padding:10px;} 
  14.                     h1        {font-size:150%; 
  15.                                 color: #0000FF; 
  16.                                 margin:0px; 
  17.                                 border:0px; 
  18.                                 padding:0px;} 
  19.                     div.level2 {padding:0px, 10px; 
  20.                                   border: medium groove rgb(111,111,111);
  21.                                   margin: 0px;} 
  22.                     h2        {font-size:130%; 
  23.                                 color: #11EE11; 
  24.                                 margin:0px; 
  25.                                 border:0px; 
  26.                                 padding:0px;} 
  27.                     div.link {margin:3px, 10px;} 
  28.  
  29.                     a            {font-weight: bold;} 
  30.                     a:link     {color: #FFFFFF;} 
  31.                     a:visited     {color: #FFFFFF;} 
  32.                     a:hover     {color: #0000FF;} 
  33.                     a:active     {color: #FF0000;} 
  34.                     a.new     {font-size: 60%;} 
  35.  
  36.                 </style> 
  37.     </head> 
  38.     <body> 
  39.         <div class="level1"> 
  40.             <h1>Admin</h1> 
  41.             <div class="level2"> 
  42.                 <h2>Applications</h2> 
  43.                 <div class="link"><a href="http://www.google.ca" class="main">Google</a>  <a href="http://www.google.ca" target="_blank" class="new">New Window</a></div> 
  44.             </div> 
  45.         </div> 
  46.     </body> 
  47. </HTML> 
  48.  
I added them in and it seems to work in the browsers you mentioned for me.
Moderator
 
Join Date: Mar 2006
Posts: 1,103
#3: Oct 16 '08

re: CSS Border only showing in IE6, not FireFox 3, Opera


Ah,ok thanks. can't believe it was something that stupid. Error didn't show when I validated with w3c. Curse IE6 for rendering invalid pages.
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,561
#4: Oct 17 '08

re: CSS Border only showing in IE6, not FireFox 3, Opera


Another problem you will have is that you are using the xml declaration on the first line. It is correct to do this but only modern browsers understand it while IE6 will go into quirks mode and not attempt to perform like a modern browser.

Also, case matters in XHTML. Your closing tag </HTML> will be flagged by the validator. Not that is matters because you aren't serving XHTML anyway and no version of IE handles XHTML either.
Reply


Similar HTML / CSS bytes