您的位置:首页 > 其它

扩大文字a链接的可点击区域

2015-10-27 14:20 393 查看
我这边扩大可点击区域和网络上的这篇并不一样http://rmingwang.com/a-text-link-to-expand-the-clickable-area.html

  很多时候是a和div的套接让一些内部的线要左边留白,但是无论是用margin-left或者padding-left,悬停后左边的留白还是会在,无论如何用a.hover定样式,left再设置为负都没有用,因为字已经被挤压空诺干像素,在压回去字会缺失。

  这里上代码:

   if (count == 1)
{
sb.Append("<li style=\"line-height:44px;\"><a href=\"" + url + "q_" + tid + ".html\"><div class=\"line\">" + title + "<div class=\"jiantou\"></div></div></a></li>");
}
else
{
if (count == dt.Rows.Count)
{
sb.Append("<li class=\"last\" ><a href=\"" + url + "q_" + tid + ".html\"><div class=\"noline\">" + title + "<div class=\"jiantou\"></div></div></a></li>");
}
else
{
sb.Append("<li style=\"line-height:44px;\"><a href=\"" + url + "q_" + tid + ".html\"><div class=\"line\">" + title + "<div class=\"jiantou\"></div></div></a></li>");
}
}这里的line是第一行下面和内容下面的线,但是最后一行就不用线了。
.line {
border-bottom: 1px solid #e2e3e7;
width: 100%;
margin-left: 15px;
margin-right: 0px;
padding: 0px 0px 0px 0px;
height: 43px;
}
.noline {

width: 100%;
margin-left: 15px;
margin-right: 0px;
padding: 0px 0px 0px 0px;
height: 43px;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: