mlg5454
09-04-2011, 06:48 AM
here's where i'm messing around:
http://professorcuddlecore.com/about/skye3.html
why is it that this
HTML
<div id="menu">
<ul>
<li><a href=""><img src="/jpgs/images/skye_menu_01.jpg" /></a></li>
<li><a href=""><img src="/jpgs/images/skye_menu_02.gif" /></a></li>
<li><a href=""><img src="/jpgs/images/skye_menu_03.gif" /></a></li>
<li><a href=""><img src="/jpgs/images/skye_menu_04.gif" /></a></li>
<li><a href=""><img src="/jpgs/images/skye_menu_05.gif" /></a></li>
</ul>
CSS
#menu {
position: absolute;
top: 0px;
left: 0px;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
li {
display: inline;
}
img {
margin: 0; padding: 0;
border: none;
}
a {
margin: 0; padding: 0;
border: none;
text-decoration: none;
display: block;
float: left;
}
this only works when i use float:left with the a element? why doesn't margin/padding to 0 on everything (i've tried * and html) work? i don't know why the a is block displayed either but it's recommended so i'm doing it. i just don't understand why.
this guy explains how it works but doesn't explain why:
http://line25.com/tutorials/how-to-create-a-css-menu-using-image-sprites/comment-page-2#comments
http://professorcuddlecore.com/about/skye3.html
why is it that this
HTML
<div id="menu">
<ul>
<li><a href=""><img src="/jpgs/images/skye_menu_01.jpg" /></a></li>
<li><a href=""><img src="/jpgs/images/skye_menu_02.gif" /></a></li>
<li><a href=""><img src="/jpgs/images/skye_menu_03.gif" /></a></li>
<li><a href=""><img src="/jpgs/images/skye_menu_04.gif" /></a></li>
<li><a href=""><img src="/jpgs/images/skye_menu_05.gif" /></a></li>
</ul>
CSS
#menu {
position: absolute;
top: 0px;
left: 0px;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
li {
display: inline;
}
img {
margin: 0; padding: 0;
border: none;
}
a {
margin: 0; padding: 0;
border: none;
text-decoration: none;
display: block;
float: left;
}
this only works when i use float:left with the a element? why doesn't margin/padding to 0 on everything (i've tried * and html) work? i don't know why the a is block displayed either but it's recommended so i'm doing it. i just don't understand why.
this guy explains how it works but doesn't explain why:
http://line25.com/tutorials/how-to-create-a-css-menu-using-image-sprites/comment-page-2#comments