Blogger Information
Blog 42
fans 3
comment 2
visits 40506
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
纯css丝带导航
虞者自愚的博客
Original
898 people have browsed it

代码


实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>css丝带导航</title>
    <style type="text/css">
        body,div,ul,li{margin:0;padding:0;font-family: '微软雅黑';}  /* 样式重置 */
        body {background-color:#444;}
        .nav{
            width:450px;
            height:50px;
            background-color:#fff;
            margin:200px auto 0;
            position:relative;
        }
       .nav .left{
            position:absolute;
            left:-18px;
            top:8px;
            width:36px;
            height:36px;
            background-color:#444;
            transform:rotate(45deg); /* 旋转45度 */

        }
        .nav .right{
            position:absolute;
            right:-18px;
            top:8px;
            width:36px;
            height:36px;
            background-color:#444;
            transform:rotate(45deg); /* 旋转45度 */

        }
        .nav ul{
            position:relative;
            top:-10px;
            width:350px;
            height:60px;
            margin:0 auto;
            overflow:hidden;
            display:flex;

        }
        .nav ul li {
            position:relative;
            top:10px;
            width:70px;
            height:50px;
            line-height:50px;
            text-align:center;
            background-color:#fff;
            transition: .4s;
            list-style: none;
            box-shadow:0 20px 0 -10px #444;
            cursor:pointer;
        }
        .nav ul li:hover {
        top:0;
        background-color:yellow;
        border-radius:3%;

        }
        .nav ul li:before {
            position:absolute;
            top:50px;
            display:block;
            content: '';
            width:10px;
            height:10px;
            background-image:linear-gradient(45deg,#fff 50%,#ccc 50%);
        }
        .nav ul li:after {
            position:absolute;
            top:50px;
            right:0;
            display:block;
            content: '';
            width:10px;
            height:10px;
            background-image:linear-gradient(-45deg,#fff 50%,#ccc 50%);
        }

    </style>
</head>
<body>
<div class="nav">
<div class="left"></div>
<ul>
    <li>HOME</li>
    <li>HOME</li>
    <li>HOME</li>
    <li>HOME</li>
    <li>HOME</li>
</ul>
<div class="right"></div>
</div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例




今天在网上看到的一个这样的导航,觉得挺好看的,就自己写了下来

相对定位与绝对定位,包括伪类的使用,重在理解过程

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post