DIV在另一个DIV里面垂直居中,水平居中
HTML:
<div class="parent"> <div class="children"> <div class="close"> <img src="image/ico/icon-close.png" /> </div> </div> </div>
CSS:
<style type="text/css"> .parent { width:800px; height:800px; background:#286921; position:relative; } .children { border:3px #fff solid; width:80px; height:80px; margin:auto; top: 0; left: 0; bottom: 0; right: 0; position: absolute; } .close { } </style>
积累小的知识,才能成就大的智慧,希望网上少一些复制多一些原创有用的答案