HTML Help why dosent the following code work?

  • Thread starter Thread starter Zebra Z
  • Start date Start date
Z

Zebra Z

Guest
i used the following css menue but it dosent work even though i copied in in the head section

where shall i put the code to work

<style type="text/css">
/
* credits: www.freecssmenus.co.uk */
.nav{ font: bold 13px Arial;
width: 480px;
border-bottom: 2px solid #663333;
}
.nav ul{ margin: 0;
padding: 0;
float: left;
width: 480px;
border: 1px solid #000000;
border-width: 1px 0;
background:url(purple791.gif) repeat-x;
}
.nav ul li{ display: inline;
}
.nav ul li a{ float: left;
color: #FFFFFF;
padding: 10px 20px;
text-decoration: none;
border-right: 1px solid #555555;
border-left: 1px solid #555555;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.nav ul li a:visited{ color: #3399FF;
}
.nav ul li a:hover, .nav ul li .current{ color: white;
background-color:#66CC66;
padding-top: 11px;
padding-bottom: 9px;
padding-right: 18px;
padding-left: 22px;
}

</style>

and my own code is here
<h1 >Home</h1>


<style type="text/css">
ul {list-style-type: none; padding-top: 20px; padding-bottom: 20px;}
ul li {list-style-type: none}
body {background-image: url("pinksite.jpg")}
</style>

<div style="display: inline; position: relative; top: 58px;">
<p>
<div style="text-align: center;">
<a href="about Us.htm" title="About Us"><img style="width: 70px; height: 80px; border: 0;" src="about us.jpg" alt="About Us"></a>
<a href="Contact Us.htm" title="Contact Us"><img style="width: 70px; height: 80px; border: 0;" src="Contact Us.jpg" alt="Contact Us Us"></a>
<a href="Genre.htm" title="Genre"><img style="width: 70px; height: 80px; border: 0;" src="Genre.jpg" alt="Genre"></a>

</div>

<html>
<head>
<style type="text/css">
h1 {color: FF00FF}
p {color: rgb(000000)}
</style>
</head>

<body>
<center>


<h1>Best Sellers</h1>
<p>Limitd Period Sale Now On</p><br><br><br><br>
</CENTER>
</body>

</html>




<html>
<head>
<style type="text/css">
div.img
{
margin: 2px;
border: 1px solid #9900FF;
height: auto;
width: auto;
float: right;

}
div.img img
{


}
div.img a:hover img {border: 1px solid #0000ff;}
div.desc
{
text-align: center;
font-weight: normal;
width: 120px;
margin: 2px;
}
</style>
</head>
<body>
<center>
<div class="img">
<a target="_blank" href="klematis2_big.htm"><img src="Cliff Richard.jpg" alt="Cliff Richard" width="110" height="90" /></a>
<div class="desc">Price: £19.99 <br>Cliff Rich's Newly Released DVD </div>
</div>

<div class="img">
<a target="_blank" href="klematis2_big.htm"><img src="Viva La Diva.jpg" alt="Viva La Diva" width="110" height="90" /></a>
<div class="desc">Price: £14.99 <br> <br>Viva La Diva </div>
</div>
<div class="img">
<a target="_blank" href="klematis3_big.htm"><img src="Take that.jpg" alt="Take Thtat" width="110" height="90" /></a>
<div class="desc">Price: £11.15 Limited Offer<br> Take That </div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="Sampson.jpg" alt="George Sampson" width="110" height="90" /></a>
<div class="desc"> Only £5.90 George Sampson <br><br> </div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="Kylie.jpg" alt="Kylie" width="110" height="90" /></a>
<div class="desc">Price: Only £14.99 <br><br> Kylie Minogue</div>

<br>
<br>
<br>
<a href="The Link Goes Here" title="About Us"><img style="width: 70px; height: 80px; border: 0;" src="about us.jpg" alt="About Us"></a>
</div>

<center>

</body>
</html>


</body>


</style>




<html>
<head>



</div>
 
CSS Should be in a styles.css which is loaded into the Index.html

With a code like this

<link rel="stylesheet" type="text/css" href="style.css" />
 
Your coding is entirely wrong too many open and closing tags for html and head.

Edit:

Here is how it should be, this should work

<html>
<head>
<title>Your title should go here</title>
<style type="text/css">
/
* credits: www.freecssmenus.co.uk */
.nav{ font: bold 13px Arial;
width: 480px;
border-bottom: 2px solid #663333;
}
.nav ul{ margin: 0;
padding: 0;
float: left;
width: 480px;
border: 1px solid #000000;
border-width: 1px 0;
background:url(purple791.gif) repeat-x;
}
.nav ul li{ display: inline;
}
.nav ul li a{ float: left;
color: #FFFFFF;
padding: 10px 20px;
text-decoration: none;
border-right: 1px solid #555555;
border-left: 1px solid #555555;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.nav ul li a:visited{ color: #3399FF;
}
.nav ul li a:hover, .nav ul li .current{ color: white;
background-color:#66CC66;
padding-top: 11px;
padding-bottom: 9px;
padding-right: 18px;
padding-left: 22px;
}
ul {list-style-type: none; padding-top: 20px; padding-bottom: 20px;}
ul li {list-style-type: none}
body {background-image: url("pinksite.jpg")}
h1 {color: FF00FF}
p {color: rgb(000000)}
div.img
{
margin: 2px;
border: 1px solid #9900FF;
height: auto;
width: auto;
float: right;

}
div.img img
{

}
div.img a:hover img {border: 1px solid #0000ff;}
div.desc
{
text-align: center;
font-weight: normal;
width: 120px;
margin: 2px;
}
</style>
</head>
<body>

<h1>Home</h1>
<div style="display: inline; position: relative; top: 58px;">
<p>
<div style="text-align: center;">
<a href="about Us.htm" title="About Us"><img style="width: 70px; height: 80px; border: 0;" src="about us.jpg" alt="About Us"></a>
<a href="Contact Us.htm" title="Contact Us"><img style="width: 70px; height: 80px; border: 0;" src="Contact Us.jpg" alt="Contact Us Us"></a>
<a href="Genre.htm" title="Genre"><img style="width: 70px; height: 80px; border: 0;" src="Genre.jpg" alt="Genre"></a>
</div>
<center>
<h1>Best Sellers</h1>
<p>Limitd Period Sale Now On</p><br><br><br><br>
<div class="img">
<a target="_blank" href="klematis2_big.htm"><img src="Cliff Richard.jpg" alt="Cliff Richard" width="110" height="90" /></a>
<div class="desc">Price: £19.99 <br>Cliff Rich's Newly Released DVD </div>
</div>
<div class="img">
<a target="_blank" href="klematis2_big.htm"><img src="Viva La Diva.jpg" alt="Viva La Diva" width="110" height="90" /></a>
<div class="desc">Price: £14.99 <br> <br>Viva La Diva </div>
</div>
<div class="img">
<a target="_blank" href="klematis3_big.htm"><img src="Take that.jpg" alt="Take Thtat" width="110" height="90" /></a>
<div class="desc">Price: £11.15 Limited Offer<br> Take That </div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="Sampson.jpg" alt="George Sampson" width="110" height="90" /></a>
<div class="desc"> Only £5.90 George Sampson <br><br> </div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="Kylie.jpg" alt="Kylie" width="110" height="90" /></a>
<div class="desc">Price: Only £14.99 <br><br> Kylie Minogue</div>
<br>
<br>
<br>
<a href="The Link Goes Here" title="About Us"><img style="width: 70px; height: 80px; border: 0;" src="about us.jpg" alt="About Us"></a>
</div>
</div>
</center>

</body>
</html>

P.S. The center tag is depreciated, you should use something like this <p style="text-align: center">Text here</p>
 
Hi - with just a quick look - there's a number of errors in your tags. It's great you're starting to use css - and this will let you get rid of the depreciated (soon to be gone) <center> tags that you're using. You could also use padding/margins to get rid of the <br /> that your using for spacing. Also, you would want to include a doctype so your css and html is correctly rendered in browsers. A basic page framework should look something like:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<style type="text/css">
/* your styles - this is a css comment statement - note the /* are together on the same line. Also, you can put all your styles together in a seperate style sheet and use a <link ...> html tag to reference the file. Look at w3c schools for tutorials and more info on tags. */
</style>
</head>
<body>
<!-- your page code - this is an html comment -->
</body>
</html>


Here's the updated code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<style type="text/css">
/* credits: www.freecssmenus.co.uk */

/* from the style block that was in the body */
ul {list-style-type: none; padding-top: 20px; padding-bottom: 20px;}
ul li {list-style-type: none}
body {background-image: url("pinksite.jpg")}

.nav{ font: bold 13px Arial;
width: 480px;
border-bottom: 2px solid #663333;
}
.nav ul{ margin: 0;
padding: 0;
float: left;
width: 480px;
border: 1px solid #000000;
border-width: 1px 0;
background:url(purple791.gif) repeat-x;
}
.nav ul li{ display: inline;
}
.nav ul li a{ float: left;
color: #FFFFFF;
padding: 10px 20px;
text-decoration: none;
border-right: 1px solid #555555;
border-left: 1px solid #555555;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.nav ul li a:visited{ color: #3399FF;
}
.nav ul li a:hover, .nav ul li .current{ color: white;
background-color:#66CC66;
padding-top: 11px;
padding-bottom: 9px;
padding-right: 18px;
padding-left: 22px;
}

/* from the style block that was in the body */
h1 {color: FF00FF}
p {color: rgb(000000)}

/* from another block that was in the body */
div.img
{
margin: 2px;
border: 1px solid #9900FF;
height: auto;
width: auto;
float: right;
}
div.img img
{
}
div.img a:hover img {border: 1px solid #0000ff;}
div.desc
{
text-align: center;
font-weight: normal;
width: 120px;
margin: 2px;
}
</style>
</head>

<body>
<h1 >Home</h1>
<div style="display: inline; position: relative; top: 58px;">
<div style="text-align: center;">
<a href="about Us.htm" title="About Us"><img style="width: 70px; height: 80px; border: 0;" src="about us.jpg" alt="About Us"></a>
<a href="Contact Us.htm" title="Contact Us"><img style="width: 70px; height: 80px; border: 0;" src="Contact Us.jpg" alt="Contact Us Us"></a>
<a href="Genre.htm" title="Genre"><img style="width: 70px; height: 80px; border: 0;" src="Genre.jpg" alt="Genre"></a>
</div>


<center>
<h1>Best Sellers</h1>
<p>Limitd Period Sale Now On</p><br><br><br><br>
</CENTER>

<center>
<div class="img">
<a target="_blank" href="klematis2_big.htm"><img src="Cliff Richard.jpg" alt="Cliff Richard" width="110" height="90" /></a>
<div class="desc">Price: £19.99 <br>Cliff Rich's Newly Released DVD </div>
</div>

<div class="img">
<a target="_blank" href="klematis2_big.htm"><img src="Viva La Diva.jpg" alt="Viva La Diva" width="110" height="90" /></a>
<div class="desc">Price: £14.99 <br> <br>Viva La Diva </div>
</div>
<div class="img">
<a target="_blank" href="klematis3_big.htm"><img src="Take that.jpg" alt="Take Thtat" width="110" height="90" /></a>
<div class="desc">Price: £11.15 Limited Offer<br> Take That </div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="Sampson.jpg" alt="George Sampson" width="110" height="90" /></a>
<div class="desc"> Only £5.90 George Sampson <br><br> </div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm"><img src="Kylie.jpg" alt="Kylie" width="110" height="90" /></a>
<div class="desc">Price: Only £14.99 <br><br> Kylie Minogue</div>

<br>
<br>
<br>
<a href="The Link Goes Here" title="About Us"><img style="width: 70px; height: 80px; border: 0;" src="about us.jpg" alt="About Us"></a>
</div>
</body>
</html>
 
Back
Top