Home  >  Article  >  Web Front-end  >  HTML 负margin 两列列表布局_html/css_WEB-ITnose

HTML 负margin 两列列表布局_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 09:18:211240browse

<ul class="nav-grid">	<li><a class="border-full" href="${pageContext.request.contextPath}/newapp/stylistService/serviceOrders">预约</a></li>	<li><a class="border-full">主页</a></li>	<li><a class="border-full">账单</a></li>	<li class="col2-top"><a class="border-full">消息</a></li>	<li class="col2"><a class="border-full">评价</a></li></ul>
/*首页网格*/.nav-grid {margin:0px;padding:0px;width:100%;list-style: none;display: inline;font-size: 0px;}.nav-grid li {width:45%;padding-bottom:35%;font-size: 15px;position: relative;margin:4% 2% 4% 3%;background-color: #fff;}.nav-grid li a{position: absolute;display: inline-block;height: 100%;width: 100%;text-align: center;vertical-align: middle;}.nav-grid li.col2-top{margin-top:-117% !important; margin-left:52% !important;}.nav-grid li.col2{margin-left:52%;}

  效果

整个过程是这样的:

    margin-top:-117%;以后,消息和评价位置会上提,覆盖了前面三个,然后增加margin-left 使得水平距离增加,达到两列的效果。

参考http://blog.aizhet.com/web/5156.html 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn