先弄懂after伪类的用法,就可以很容易理解了。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.pic_box{width:400px; height:400px; background-color:#beceeb; font-size:0; *font-size:200px; text-align:center;}
.pic_box .div{vertical-align:middle;width: 100px;height: 100px;background-color: blue;display: inline-block;}
.pic_box:after{display:inline-block; width:0;height:100%; content:"111111111111"; vertical-align:middle; overflow:hidden;}
</style>
</head>
<body>
<div class="pic_box">
<div class="div"></div>
</div>
</body>
</html>
效果图
时间: 2024-11-05 13:30:12