把div标签整块做成链接的方法

2017-08-01  本文已影响16人  YZY君
<div class="list clearfix" >
  <a href="/a/b" class="news-link" target="_blank"></a>
</div>
.column_1 .jslist .list {
    /* 父级元素要先定位*/
    position: relative;
}
.news-link {
    position: absolute;
    margin: auto;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    text-indent: -999em;
    white-space: nowrap;
    overflow: hidden;
    z-index: 0;
}
上一篇下一篇

猜你喜欢

热点阅读