码迷,mamicode.com
首页 > 其他好文 > 详细

网易云音乐首页导航样式的实现

时间:2017-04-18 13:50:14      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:scroll   样式   pre   code   pad   href   http   lan   ext   

实现效果图:

技术分享

背景图片:

技术分享

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{margin:0;padding:0;list-style-type:none;color: azure;text-decoration: none;}

        ul,ul li,ul li a {
            background: url("img/sprite.gif") no-repeat scroll left top;
        }
        ul {
            width: 100%;
            height: 40px;
            line-height: 40px;
            background-color:#CC0000;
            background-repeat: repeat-x;
            background-position: 0 0;
        }
        ul li {
            position: relative;
            float: left;
            padding:0  20px;
            background-position:0 -40px ;
}
</style> </head> <body> <ul> <li><a href="#" >首页</a></li> <li><a href="#">素材</a></li> <li><a href="#" >图片</a> </li> <li> <a href="#" >图标</a> </li> </ul> </body> </html>

注意:background:url("img/sprite.gif") no-repeat scroll left top中的left后面的值不可缺少,可以为top、0、-9999px、999px等;
     background-repeat:repeat-x;放在ul或者li均可; 
     如果想让背景边框线变短,在ul的样式中加入padding-top:10px替代line-height:40px,并把ul,ul li,ul li a 此处的ul去掉。
 
 
 

 

网易云音乐首页导航样式的实现

标签:scroll   样式   pre   code   pad   href   http   lan   ext   

原文地址:http://www.cnblogs.com/iriliguo/p/6727375.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!