【案例】相对定位实现波浪效果

<!DOCTYPE html>

<html lang="en">

<head>

        <meta charset="UTF-8">

        <title>相对定位实现波浪效果</title>

        <style>

                 *{

                         margin:0;

                         padding:0;

                 }

                 li{

                         list-style: none;

                 }

                 a{

                         text-decoration: none;

                 }

                 ul{

                         width: 200px;

                         height: 240=6px;

                         margin-top: 20px;

                         margin-left: 10px;

                         border: 1px solid skyblue;

                 }

                 ul>li{

                         width: 100%;

                         height: 40px;

                         line-height: 40px;

                         text-align: center;

                         border-bottom: 1px dashed skyblue;

                         background: pink;

                 }

                 ul>li:hover{

                         background: yellow;

                         position: relative;

                         left: 2px;

                         top: 1px;

                 }

                 ul>li>a{

                         display: block;

                         color: #000;

                         font-size: 14px;

                         font-weight: 700;

                         font-family: '微软雅黑';

                 }

        </style>

</head>

<body>

        <ul>

                 <li><a href="">首页</a></li>

                 <li><a href="">博客</a></li>

                 <li><a href="">编程</a></li>

                 <li><a href="">UI设计</a></li>

                 <li><a href="">前端</a></li>

                 <li><a href="">大数据</a></li>

        </ul>

</body>

</html>

猜你喜欢

转载自www.cnblogs.com/sherryStudy/p/relative_position.html