Excavator
12-12-2006, 08:16 PM
Just started looking at this (http://www.codingforums.com/showthread.php?t=102790) this morning and thought I should start a new thread so as not to hijack the original.
That is not what was suggested above; since the images in this case should be considered presentational in nature, including them as content in the document is not the preferred method.
I didn't realize that. I've done this before with divs but never with an unordered list. It makes sense to prefer CSS background.
It is more appropriate to use CSS background images as HarbingerOTV suggested, which would also make the use of ordinary link text instead of images for text possible.
So I'm having problems getting the li to be a link with no text.
Here is what's not working so far: <!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=iso-8859-1" />
<title>vertical ul menu with buttons</title>
<meta name="" content="authored by http://www.nopeople.com" />
<style type="text/css">
html, body {
background-color: #CCCCCC;
margin: 0px;
padding: 0px;
}
* {
margin: 0px;
padding: 0px;
}
#menu_left {
padding: 0px;
width: 147px;
margin: 10px 0 0 10px;
}
#menu_left ul {
list-style-type: none;
text-align: left;
}
#menu_left li {
width: 147px;
height: 21px;
display: block;
}
#menu_left li a{
width: 147px;
height: 21px;
}
#menu_left li a:hover {
width: 147px;
height: 21px;
margin-left: 3px;
background-position: 3px;
}
.button1 {
border: 1px solid #00FF00;
background-image: url(button1.gif);
height: 21px;
width: 147px;
}
.button2 {
border: 1px solid #00FF00;
background-image: url(button2.gif);
height: 21px;
width: 147px;
}
.button3 {
border: 1px solid #00FF00;
background-image: url(button3.gif);
height: 21px;
width: 147px;
}
.button4 {
border: 1px solid #00FF00;
background-image: url(button4.gif);
height: 21px;
width: 147px;
}
.button5 {
border: 1px solid #00FF00;
background-image: url(button5.gif);
height: 21px;
width: 147px;
}
.button6 {
border: 1px solid #00FF00;
background-image: url(button6.gif);
height: 21px;
width: 147px;
}
</style>
</head>
<body>
<div id="menu_left">
<ul>
<li class="button1"><a href="http://www.nopeople.com"></a></li>
<li class="button2"><a href="http://www.nopeople.com"></a></li>
<li class="button3"><a href="http://www.nopeople.com"></a></li>
<li class="button4"><a href="http://www.nopeople.com"></a></li>
<li class="button5"><a href="http://www.nopeople.com"></a></li>
<li class="button6"><a href="http://www.nopeople.com"></a></li>
</ul>
<div class="button1"><a href="http://www.nopeople.com"></a></div>
</div>
</body>
</html>
That is not what was suggested above; since the images in this case should be considered presentational in nature, including them as content in the document is not the preferred method.
I didn't realize that. I've done this before with divs but never with an unordered list. It makes sense to prefer CSS background.
It is more appropriate to use CSS background images as HarbingerOTV suggested, which would also make the use of ordinary link text instead of images for text possible.
So I'm having problems getting the li to be a link with no text.
Here is what's not working so far: <!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=iso-8859-1" />
<title>vertical ul menu with buttons</title>
<meta name="" content="authored by http://www.nopeople.com" />
<style type="text/css">
html, body {
background-color: #CCCCCC;
margin: 0px;
padding: 0px;
}
* {
margin: 0px;
padding: 0px;
}
#menu_left {
padding: 0px;
width: 147px;
margin: 10px 0 0 10px;
}
#menu_left ul {
list-style-type: none;
text-align: left;
}
#menu_left li {
width: 147px;
height: 21px;
display: block;
}
#menu_left li a{
width: 147px;
height: 21px;
}
#menu_left li a:hover {
width: 147px;
height: 21px;
margin-left: 3px;
background-position: 3px;
}
.button1 {
border: 1px solid #00FF00;
background-image: url(button1.gif);
height: 21px;
width: 147px;
}
.button2 {
border: 1px solid #00FF00;
background-image: url(button2.gif);
height: 21px;
width: 147px;
}
.button3 {
border: 1px solid #00FF00;
background-image: url(button3.gif);
height: 21px;
width: 147px;
}
.button4 {
border: 1px solid #00FF00;
background-image: url(button4.gif);
height: 21px;
width: 147px;
}
.button5 {
border: 1px solid #00FF00;
background-image: url(button5.gif);
height: 21px;
width: 147px;
}
.button6 {
border: 1px solid #00FF00;
background-image: url(button6.gif);
height: 21px;
width: 147px;
}
</style>
</head>
<body>
<div id="menu_left">
<ul>
<li class="button1"><a href="http://www.nopeople.com"></a></li>
<li class="button2"><a href="http://www.nopeople.com"></a></li>
<li class="button3"><a href="http://www.nopeople.com"></a></li>
<li class="button4"><a href="http://www.nopeople.com"></a></li>
<li class="button5"><a href="http://www.nopeople.com"></a></li>
<li class="button6"><a href="http://www.nopeople.com"></a></li>
</ul>
<div class="button1"><a href="http://www.nopeople.com"></a></div>
</div>
</body>
</html>