首页 > 代码库 > CSS备忘
CSS备忘
垂直居中:
先height再ling-height,都设成一样高
设置外边距:
margin-top,margin-left,margin-right,margin-bottom
div背景单张铺满设置:
width: 30px;
height: 30px;
line-height: 30px;
background-image: url(../image/lzhf/one.png);
background-repeat: no-repeat;
background-size: 100% auto;
div浮在div上:
<div style="position: relative;height: 30px;width: 100%">
<div style="height: 30px; overflow: hidden;position: absolute;z-index: 2;width: 100%;">
<img alt="主要职责" style="width: 100%; height: 30px;"
src="http://www.mamicode.com/image/ljfy/zcjgtop.png">
</div>
<div style="position: absolute;z-index: 3;margin-left:10px;height: 30px;line-height: 30px;">
<img src="http://www.mamicode.com/image/ljfy/zyzzc.png" width="30" height="30">
</div>
<div style="position: absolute;z-index: 3;margin-left: 38px;height: 30px;line-height: 30px;">
<font style="font-weight: bold">共有内设机构20个</font>
</div>
</div>
解决非固定宽度的浮动问题:
结束加上<div style="clear:both;height: 0px;"></div>