Forum Moderators: not2easy
I use a list and on the a display as block so I can have a hover color.
Whats happening is that some links have a HUGE gap under them and some don't. I cannot for the life of me figure out why.
Here's CSS
.lcontain {margin-left:10px;border-right:1px solid #BCBCBC;border-left:1px solid #BCBCBC;border-top:1px solid #BCBCBC;}
#lbutton2 {font-size:11px;}
#lbutton2 ul {margin: 0;padding: 0;list-style: none; width:145px;}
#lbutton2 li {/*border-bottom:1px solid #cccccc;*/}
#lbutton2 li a{display:block;padding:0; position:relative;color:#0000FF;/*333333*/text-decoration:none;}
#lbutton2 li a:hover {text-decoration:underline; background:#F2F7FA;}
#lbutton2 li.bottom {border-bottom:1px solid #cccccc;}
and here's the code for the list
<div class="lcontain">
<div id="lbutton2">
<div style="background-image: url(/images/amazing-deal.gif); background-repeat:no-repeat; text-align:center; padding:2px; "><font color="#FFFFFF"><%Response.Write Date%><br>
<strong>AMAZING DEAL OF THE DAY!</strong></font><br><br>
<a href="http://LINK.asp">LINK</a><br>
<br>
</div>
<div class="headfont2">Shop By Category > </div>
<ul>
<li><a href="/link.asp">link</a></li>
<li><a href="/link.asp">link & link </a></li>
<li><a href="/link.asp">link</a></li>
<li><a href="/link.asp">link </a></li>
ETC...long list.
</ul>
</div>
</div>
I was wondering if maybe the margin on the container element is causing the problem, but I have another list on the other side of the web site and it does the same thing on the main ul, but any nested ul with in li works like a charm, I just cant figure it out.
This hack (two options) will simulate a fix long enough for you to identify where the space is coming from. I'll come back to it later if unresolved. It's a simple fix I'm sure, just no time right now for more than the hack.
#lbutton2 li {
border: 1px solid #fff; /*height: 1em;*/
}
This is a bug in IE. You can fix it by simply changing the default display type of list items:
#lbutton2 li { display: inline; } IE has a problem where if you set the content of a defaultly displayed list item to be displayed as block, it will display the whitespace (spaces, tabs, etc from the </li> to the next item's <li>) on a new line. Having the list items displayed inline will fix that.
Let us know how it goes :)
It's because
<dd> elements, by default, are of display type block. List items' default display type is list-item. The bug will not present. However, if you're not actually defining anything you shouldn't use a definition list. If you included the "Shop by Category" as a
<dt> you could probably get away with it... you just have to be careful of the correct usage of elements.
If you had group of <dt>, "Shop by Category" being one - then multiple <dd> would be acceptable to me. No different than using multiple <ul> or <ul>; maybe preferable. Actually, no reason that you can't use single <dt> with multiple <dd>, though less common because an <ul> or <ol> would typically be the first tool one reaches for.
I suppose that defining 'definition' is a choice we have to make along the way. I use <dl> quite a lot. Often surprises me how many people never use them or have no idea how flexible they can be.