I have a vertical column of links in a table, and I would like to convert it to CSS. If anyone has the time, I would greatly appreciate the help.
Original code:
<table border="0" align="left" bgcolor="#000066" width="220" cellspacing="0">
<tr>
<th><font color="#cccccc">Our Products</font></th>
</tr>
<!-- Vertical Nav Bar Links Nested in Table 2 -->
<tr>
<td align="center"><table border="3" align="center" bgcolor="#cccccc" width="180" cellspacing="0">
<!-- Begin Vertical Nav Bar Links Table 3 -->
<tr>
<td align="center"><a href=http://www.webdeveloper.com/forum/archive/index.php/"aodcat.htm" title="AOD Performance Products">AOD Products</a></td>
</tr>
<tr>
<td align="center"><a href=http://www.webdeveloper.com/forum/archive/index.php/"aodecat.htm" title="AODE and 4R70W Performance Products">AODE/4R70W Products</a></td>
</tr>
<tr>
<td align="center"><a href=http://www.webdeveloper.com/forum/archive/index.php/"e4odcat.htm" title="E4OD and 4R100E Performance Products">E4OD/4R100E Products</a></td>
</tr>
<tr>
<td align="center"><a href=http://www.webdeveloper.com/forum/archive/index.php/"electronicscat.htm" title="Our Innovative Electronic Products">Electronic Products</a></td>
</tr>
<tr>
<td align="center"><a href=http://www.webdeveloper.com/forum/archive/index.php/"othercat.htm" title="Other Transmission Related Products">Other Products</a></td>
</tr>
</table></td>
<tr>
<td> </td>
</tr>
</table>
Greg<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Lorem ipsum</title>
<style type="text/css">
<!--
#main {margin-left:11em}
#menu {position:absolute; top:1em}
.separator {display:none}
#menu a {display:block; margin:1em 0em; width:10em}
-->
</style>
<div id="main">
<h1>Lorem ipsum</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipitlobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor *** soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem.</p>
</div>
<div id="menu">
<h4>Our Products</h4>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"aodcat.htm" title="AOD Performance Products">AOD Products</a>
<span class="separator">|</span>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"aodecat.htm" title="AODE and 4R70W Performance Products">AODE/ 4R70W Products</a>
<span class="separator">|</span>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"e4odcat.htm" title="E4OD and 4R100E Performance Products">E4OD/ 4R100E Products</a>
<span class="separator">|</span>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"electronicscat.htm" title="Our Innovative Electronic Products">Electronic Products</a>
<span class="separator">|</span>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"othercat.htm" title="Other Transmission Related Products">Other Products</a>
</div>Thanks, I greatly appreciate it. You code faster than I type I've read about id versus classes a couple of places, but I don't quite understand what the advantages of each are. Can you use a class anywhere you can use an id?
Is the id easier or better in some cases?Class is used to define something that will be used more than once, and id is used to define something that will be used only once.
<div class="blueBox">
<div id="menu">If you put an id in an external style sheet I'm assuming it can be used once per page?An id should be defined only once per page regardless if the CSS is defined externally, or not. Using the id attribute is like giving something a name, and if you name two different things the same thing, then how do you know which one of the two gets something applied to it? Just think of using id to define what is going to be your header. Do you really define two things as being headers? Not really.How can I get the same background colors I had?#menu {position:absolute; top:1em; background-color: #cccccc;}
I think that was the color you are referring to lol. Change it if it's not.I would get rid of the word products in your menu links since it is already in the menu header.
CSS:
#menu2 { width:12%; background-color:#006; color:#FFF; padding:0px 15px 15px 15px; text-align:center; }
#menu2 h4 { margin-bottom:5px; }
li { list-style-type:none; padding:5px; }
ul { margin:0; padding:0; background-color:#CCC; border:3px solid #FFF; }
HTML:
<div id="menu2">
<h4>Our Products</h4>
<ul>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"aodcat.htm" title="AOD Performance Products">AOD Products</a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"aodecat.htm" title="AODE and 4R70W Performance Products">AODE/ 4R70W Products</a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"e4odcat.htm" title="E4OD and 4R100E Performance Products">E4OD/ 4R100E Products</a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"electronicscat.htm" title="Our Innovative Electronic Products">Electronic Products</a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"othercat.htm" title="Other Transmission Related Products">Other Products</a></li>
</ul>
</div>ID is used in JavaScript (as well as CSS), which I believe is why you don't want 2 things on one page using the same ID, because it would break any JavaScript that references that ID.Actually, the reason is because an ID is a document unique identifier. <!-- m --><a class="postlink" href="http://www.w3.org/TR/REC-html40/struct/global.html#adef-id">http://www.w3.org/TR/REC-html40/struct/ ... ml#adef-id</a><!-- m -->
Original code:
<table border="0" align="left" bgcolor="#000066" width="220" cellspacing="0">
<tr>
<th><font color="#cccccc">Our Products</font></th>
</tr>
<!-- Vertical Nav Bar Links Nested in Table 2 -->
<tr>
<td align="center"><table border="3" align="center" bgcolor="#cccccc" width="180" cellspacing="0">
<!-- Begin Vertical Nav Bar Links Table 3 -->
<tr>
<td align="center"><a href=http://www.webdeveloper.com/forum/archive/index.php/"aodcat.htm" title="AOD Performance Products">AOD Products</a></td>
</tr>
<tr>
<td align="center"><a href=http://www.webdeveloper.com/forum/archive/index.php/"aodecat.htm" title="AODE and 4R70W Performance Products">AODE/4R70W Products</a></td>
</tr>
<tr>
<td align="center"><a href=http://www.webdeveloper.com/forum/archive/index.php/"e4odcat.htm" title="E4OD and 4R100E Performance Products">E4OD/4R100E Products</a></td>
</tr>
<tr>
<td align="center"><a href=http://www.webdeveloper.com/forum/archive/index.php/"electronicscat.htm" title="Our Innovative Electronic Products">Electronic Products</a></td>
</tr>
<tr>
<td align="center"><a href=http://www.webdeveloper.com/forum/archive/index.php/"othercat.htm" title="Other Transmission Related Products">Other Products</a></td>
</tr>
</table></td>
<tr>
<td> </td>
</tr>
</table>
Greg<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Lorem ipsum</title>
<style type="text/css">
<!--
#main {margin-left:11em}
#menu {position:absolute; top:1em}
.separator {display:none}
#menu a {display:block; margin:1em 0em; width:10em}
-->
</style>
<div id="main">
<h1>Lorem ipsum</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipitlobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor *** soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem.</p>
</div>
<div id="menu">
<h4>Our Products</h4>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"aodcat.htm" title="AOD Performance Products">AOD Products</a>
<span class="separator">|</span>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"aodecat.htm" title="AODE and 4R70W Performance Products">AODE/ 4R70W Products</a>
<span class="separator">|</span>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"e4odcat.htm" title="E4OD and 4R100E Performance Products">E4OD/ 4R100E Products</a>
<span class="separator">|</span>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"electronicscat.htm" title="Our Innovative Electronic Products">Electronic Products</a>
<span class="separator">|</span>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"othercat.htm" title="Other Transmission Related Products">Other Products</a>
</div>Thanks, I greatly appreciate it. You code faster than I type I've read about id versus classes a couple of places, but I don't quite understand what the advantages of each are. Can you use a class anywhere you can use an id?
Is the id easier or better in some cases?Class is used to define something that will be used more than once, and id is used to define something that will be used only once.
<div class="blueBox">
<div id="menu">If you put an id in an external style sheet I'm assuming it can be used once per page?An id should be defined only once per page regardless if the CSS is defined externally, or not. Using the id attribute is like giving something a name, and if you name two different things the same thing, then how do you know which one of the two gets something applied to it? Just think of using id to define what is going to be your header. Do you really define two things as being headers? Not really.How can I get the same background colors I had?#menu {position:absolute; top:1em; background-color: #cccccc;}
I think that was the color you are referring to lol. Change it if it's not.I would get rid of the word products in your menu links since it is already in the menu header.
CSS:
#menu2 { width:12%; background-color:#006; color:#FFF; padding:0px 15px 15px 15px; text-align:center; }
#menu2 h4 { margin-bottom:5px; }
li { list-style-type:none; padding:5px; }
ul { margin:0; padding:0; background-color:#CCC; border:3px solid #FFF; }
HTML:
<div id="menu2">
<h4>Our Products</h4>
<ul>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"aodcat.htm" title="AOD Performance Products">AOD Products</a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"aodecat.htm" title="AODE and 4R70W Performance Products">AODE/ 4R70W Products</a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"e4odcat.htm" title="E4OD and 4R100E Performance Products">E4OD/ 4R100E Products</a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"electronicscat.htm" title="Our Innovative Electronic Products">Electronic Products</a></li>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"othercat.htm" title="Other Transmission Related Products">Other Products</a></li>
</ul>
</div>ID is used in JavaScript (as well as CSS), which I believe is why you don't want 2 things on one page using the same ID, because it would break any JavaScript that references that ID.Actually, the reason is because an ID is a document unique identifier. <!-- m --><a class="postlink" href="http://www.w3.org/TR/REC-html40/struct/global.html#adef-id">http://www.w3.org/TR/REC-html40/struct/ ... ml#adef-id</a><!-- m -->