我有这个列表菜单,我想为每个项目显示箭头,所以当你将鼠标悬停在项目上时,箭头会改变颜色。到目前为止,我的问题似乎是将此箭头与文本垂直居中对齐。正如您从屏幕截图中看到的那样,它略微偏离了。忽略箭头和超链接之间缺少的空格。
小提琴:http: //jsfiddle.net/7xbse/
HTML,
<li ><a class="clear-block" href="http://wordpress.local/archives/category/announcements" title="View all posts filed under Announcements">
<span class="tt">Announcements <strong>(1)</strong></span>
<span class="c1"></span>
</a></li>
<li ><a class="clear-block" href="http://wordpress.local/archives/category/c-sharp" title="View all posts filed under C#">
<span class="tt">C# <strong>(1)</strong></span>
<span class="c1"></span>
</a></li>
<li class="extends"><a class="clear-block" href="http://wordpress.local/archives/category/c-plus-plus" title="View all posts filed under C++">
<span class="tt">C++ <strong>(1)</strong></span>
<span class="c1"></span>
</a>
<ul class="sub-menu">
<li ><a class="clear-block" href="http://wordpress.local/archives/category/c-plus-plus/multiplexing-io" title="View all posts filed under Multiplexing I/O">
<span class="tt">Multiplexing I/O <strong>(1)</strong></span>
<span class="c1"></span>
</a></li>
</ul>
</li>
CSS,
.block ul.menu, .block ul.menu ul, .block ul.menu li, .block .box, .block .box .entry{
margin:0;
padding:0;
list-style-type:none;
line-height: normal;
}
.block ul.menu li, .block ul.box .entry{
border-bottom:1px dotted #aaa;
border-top:1px dotted #fff;
}
/* no border on 1st list item */
.block ul.menu li.first,
.block ul.menu li:first-child,
.block ul.box .entry.first,
.block ul.box .entry:first-child{border-top:0 !important;}
.block ul.menu li.last,
.block ul.menu li:last-child,
.block ul.box .entry.last,
.block ul.box .entry:last-child{border-bottom:0 !important;}
.block ul.menu li .expand{display: none;}
.block ul.menu li, .block ul.box .entry {
position: relative;
z-index: 5;
}
.block ul.menu li a {
background:transparent url(../images/icons_old.png) no-repeat 4px -816px;
}
/* titles */
.block ul.menu .tt {
display:block;
}
.block ul.menu a:hover .tt{
text-decoration:underline;
}
/* content - primary */
.block ul.menu .c1{
display:block;
line-height: 150%;
color:#333;
text-decoration:none;
}
/* information block (left side) */
.block ul.menu .base {
overflow:hidden;
display:block;
}