扩大文字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;
}
很多时候是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;
}
相关文章推荐
- POJ 1577 Falling leaves (二叉树的构造)
- 分布数据文件访问多个磁盘
- CSS 元素垂直居中的 6种方法
- linux下安装 nginx 支持ssl
- Android 属性动画基本用法之代码实现
- iOS9HTTP请求问题
- Less的guards and argument matching
- 【codevs1041&&NOIP01TG】Car的旅行路线,最短路中的数学题
- strtok嵌套使用的解决方法
- java 多维数组遍历
- Android App的签名打包(晋级篇)
- CMake入门教程
- 20135210——信息安全设计基础第七周学习笔记
- 站位
- Unexpected CFBundleExecutable Key
- javascript alert,confirm,prompt弹框用法
- android新建项目
- 工具使用搜集
- 月薪3万的程序员都避开了哪些坑
- csharp: InvokeHelper