Forum Moderators: not2easy

Message Too Old, No Replies

This Code.

Whats wrong with it. Works on Windows, but not Safari.

         

phidentity

7:01 pm on Jan 25, 2004 (gmt 0)

10+ Year Member



Style.Css:

body {
padding: 5px;
background: #B0C4DE;
}

p{
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : smaller;
}

}
#level0 {
background-color : #B0C4DE;
width:100%;
}
}
#level1{
margin-left:200px;
margin-right:30px;
padding-left: 10px;
padding-top: 10px;
padding-bottom:10px;
padding-right:10px;
background-color : #70C9DE;
border : dotted #20B2AA;
position:relative;
width:inherit;
}

#level3{

margin-top: 10px;
width:175px;

background-color : #4B0082;
border : dotted #20B2AA;
}

#level4{

padding-left: 2px;
padding-right: 2px;
padding-bottom: 2px;
padding-top: 2px;
background-color : #87CEEB;

}

#menu1{
background-color : #66CDAA;
}

Html:

<html>
<head>
<link rel="stylesheet" type="text/css"
href="style.css" />
</head>
<body>

<div id="level0">

<div id="level1">
<p>the webpage of jon buchan</p>

</div>
</div>

<div id="level3">
<div id="level4">
<p align="center">Menu System</p>
<div id="menu1">
<p>home</p>
<div id=
</div</div>

It works fine on my PC, but not on Mac Safari. I gave my friend some url's to CSS tutorials and all the examples worked fine for him, so whats wrong with my code?

Cheers

Jon

pageoneresults

7:21 pm on Jan 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hello Jon, what exactly doesn't work in Safari?

phidentity

8:35 pm on Jan 25, 2004 (gmt 0)

10+ Year Member



It doesn't show the top box. Just the text inside it.

It happens in opera too.
Jon

aevea

8:38 pm on Jan 25, 2004 (gmt 0)

10+ Year Member



At the end of your html you've either got some nesting problems or typos make sure it's valid and that all your divs close. In the css the big problem I see is the lack of width in the border declarations. Change them to something like
border: 2px dotted #20b2aa
.

Adam

ram_mac

12:27 am on Jan 29, 2004 (gmt 0)

10+ Year Member



You have created extra closing brackets in the CSS that are confusing the browser, this is your main problem, although not closing divs in the HTML may not help either.
I find it helps to always add a comment at the end saying which div it is I am closing in order to keep track of them.

The code (edited for easier debugging)

The html:


<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="level0">
<div id="level1">
<p>the webpage of jon buchan</p>
</div><!--end level1-->
</div><!--end level0-->
<div id="level3">
<div id="level4">
<p align="center">Menu System</p>
<div id="menu1">
<p>home</p>
<div id="unnamed"><!--id not named, no closing bracket-->
</div><!--end unnamed-->
</div><!--end menu1-->
</div><!--end level4--><!--div not closed-->
</div><!--end level3--><!--div not closed-->

The css file:


body {
padding: 5px;
background: #B0C4DE;
}

p{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: smaller;
}
/*
}
the bracket (commented out above) is the problem
*/
#level0 {
background-color: #B0C4DE;
width:100%;}
/*
}
the bracket (commented out above) is the problem
*/
#level1{
margin: auto 30px auto 200px;
background-color: #70C9DE;
border: 1px dotted #20B2AA;/* Give borders a value! */
position: relative;
width: inherit;
}

#level3{
margin-top: 10px;
width:175px;
background-color: #4B0082;
border : 1px dotted #20B2AA;
}

#level4{
padding: 2px;
background-color : #87CEEB;
}

#menu1{
background-color : #66CDAA;
}

hope this helps in the learning process!

ps sorry about the dodgy formatting above the css comments seem to close my code tag

DrDoc

12:34 am on Jan 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World, ram_mac!
And thanks for making your post such a valuable one :)

ram_mac

12:36 am on Jan 29, 2004 (gmt 0)

10+ Year Member



Thanks I have found this forum useful myself so just spreading the love, eh!

phidentity

2:45 pm on Jan 29, 2004 (gmt 0)

10+ Year Member



I'll try this out in a few hours, thanks :)

jon