伪类 统一添加样式

伪类:   统一添加样式    很好的减少了代码量

 

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<style>
    h3{
        display: inline-block;
        position: relative;/* 父级给相对定位 */
    }
    h3:before {
    content: '';/* 必需 */
    position: absolute;/* 必需 */
    width: 10px;/* 必需 */
    height: 10px;/* 必需 */
    background: pink;
    border-radius: 50px;
    left: -20px;
    top: 10px;
}
</style>
    <div align="center">
        <h3>伪类</h3>
    </div>
</body>
</html>

 

posted @ 2017-09-25 17:05  和路雪  阅读(221)  评论(0编辑  收藏  举报