Most tutorials for navigation lists use an unordered list.
My question is: isn’t it much easier to create a navigation list without an unordered list?
For example, this here’s the code for a navigation list used by the W3Schools CSS Tutorial:
<!--html-->
<html>
<head>
<style type=”text/css“>
#navlist{position:relative;}
#navlist li{margin:0;padding:0;list-style:none;position:absolute;top:0;}
#navlist li, #navlist a{height:44px;display:block;}
#home{left:0px;width:46px;}
#home{background:url(’img_navsprites.gif’) 0 0;}
#prev{left:63px;width:43px;}
#prev{background:url(’img_navsprites.gif’) -47px 0;}
#next{left:129px;width:43px;}
#next{background:url(’img_navsprites.gif’) -91px 0;}
</style>
</head>
<body>
<ul id=”navlist“>
<li id=”home“><a href=”default.asp“></a></li>
<li id=”prev“><a href=”css_intro.asp“></a></li>
<li id=”next“><a href=”css_syntax.asp“></a></li>
</ul>
</body>
</html><!--html2-->
<!--html3-->
This code here privodes a navigation list with the same look but without a list, with less styling and without positioning:
<!--html-->
<html>
<head>
<style type=”text/css“>
#navlist{margin-left:-8px;}
#navlist a{height:44px;display:inline-block;margin:8px;}
#home{width:46px;}
#home{background:url(’img_navsprites.gif’) 0 0;}
#prev{width:43px;}
#prev{background:url(’img_navsprites.gif’) -47px 0;}
#next{width:43px;}
#next{background:url(’img_navsprites.gif’) -91px 0;}
</style>
</head>
<body>
<div id=”navlist“>
<a id=”home” href=”default.asp“></a>
<a id=”prev” href=”css_intro.asp“></a>
<a id=”next” href=”css_syntax.asp“></a>
</div>
</body>
</html><!--html2-->
<!--html3-->
As mentioned before, I can’t understand why every tutorial I find on this topic uses lists to achieve results although it’s more work this way.
Thanks in advance!
http://bit.ly/nmBR7y
No comments:
Post a Comment