首页 > 代码库 > 网易云音乐首页导航样式的实现
网易云音乐首页导航样式的实现
实现效果图:
背景图片:
<!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=http://www.mamicode.com/"#" >首页</a></li> <li><a href=http://www.mamicode.com/"#">素材</a></li> <li><a href=http://www.mamicode.com/"#" >图片</a> </li> <li> <a href=http://www.mamicode.com/"#" >图标</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去掉。
网易云音乐首页导航样式的实现
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。