栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > Html/CSS > CSS教程

css控制列表与导航的制作(水平导航条、垂直翻转的列表、垂直导航栏、内联列表、列表样

CSS教程 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

css控制列表与导航的制作(水平导航条、垂直翻转的列表、垂直导航栏、内联列表、列表样


复制代码代码如下:


body{ margin:0;}

ul{list-style:none; margin:0; padding:0;}



  • 奇才

  • 村村

  • 天干

  • 才工

  • 雪原



1.设置列表符号的样式:list-style-type

none 无符号
disc 实体的小圆点。(默认)
circle 空心的小圆点。
square 实心的小方块。
decimal 1,2,3...
lower-roman i,ii,iii...
upper-roman I,II,III...
lower-alpha a,b,c,d,e...
upper-alpha A,B,C,D,E...


复制代码代码如下:

ul{list-style:none;}
#df{list-style:lower-roman;}




  • 站在岁月的岸边,向自己的过往打个水漂吧……

  • 2011我娶你,2012我保护你,2013爱你一生,2014爱你一世!

  • 人生就像一场旅行,在乎的不是目的地。而是沿途的"SB",以及对付"SB"时的心情!

  • 臭男人都喜欢骚女人。

  • 系好安全带,前方也许有场爱情正等着你。

  • 枕着打印机睡,就能打印出一整夜的梦吧?



2.设置列表符号的样式用图片(这种方法很少用):list-style-image


复制代码代码如下:

body{margin:50px;}
ul{list-style:none; margin:0; padding:0; list-style-image:url(fasfas.gif); line-height:150%;}



  • 奇才

  • 村村

  • 天干

  • 才工

  • 雪原



3.设置清单项目左右移:list-style-position
inside 清单项目较往右移。
outside 清单项目正常显示(默认的属性)。


4.以背景图片作为项目列表图标:这种方法比较好(常用),可以随意调动


复制代码代码如下:

body{
margin:50px;
}
ul{
list-style:none;
margin:0;
padding:0;
}
ul li{
background:url(fasfas.gif) no-repeat left 50%;
padding-left:20px;
}



  • 奇才

  • 村村

  • 天干

  • 才工

  • 雪原



5.内联列表:

ul和li默认是区块的,查看是否是区块可以加上颜色测试,将列表转换为内联之后项目图标会不见,可以使用浮动或者使用下面的列子来实现

这里的 display 属性是块级值的设置,定义是否要成为块.Inline 是是内联,block 是区块.


复制代码代码如下:

body{margin:50px;}
ul{list-style:none; margin:0; padding:0;}
li{display:inline;}



  • 奇才

  • 村村

  • 天干

  • 才工

  • 雪原



6.背景图片和内联列表:使用这种方法再将li变成内联的时候背景图片仍然还在


复制代码代码如下:

body{margin:50px;}
ul{list-style:none; margin:0; padding:0;}
li{display:inline; background:url(fasfas.gif) no-repeat left center; padding-left:20px;}



  • 奇才

  • 村村

  • 天干

  • 才工

  • 雪原



7.垂直导航栏:


复制代码代码如下:

body{margin:50px;}
ul{list-style:none; margin:5px; padding:2px; width:250px; font-size: 19px;}
li { background: #ddd url(fasfas.gif) no-repeat 10px center; margin: 0; padding: 2px 35px; border-left: 1px solid #fff;
border-top: 1px solid #fff; border-right: 1px solid #666; border-bottom: 1px solid #aaa;}




  • Drubjs Menu

  • Beer

  • Spirits

  • Cola

  • Lemonade

  • Tea

  • Coffee




8、创建垂直翻转的列表:


复制代码代码如下:

body{
margin:50px;
}
ul{
list-style:none;
margin:0;
font-size:16px;
}
ul li a{
display:block;
width:200px;
height:40px;
line-height:40px;
color:#000;
text-decoration:none;
background:#94b8e9 url(2014-03-08_220129.gif) no-repeat left center;
Text-indent:50px;
}
a:hover{
background-position: right bottom;
}





  • Drubjs Menu

  • Beer

  • Spirits

  • Cola

  • Lemonade

  • Tea

  • Coffee




9.创建水平导航条:


复制代码代码如下:

body{
margin:50px;
}
ul{
list-style:none;
margin:0px;
padding:0px;
width:798px;
line-height:50px;
background:#faa819 url(2014-03-08_223706.png) repeat-x;
font-size:16px;
float:left;
}


ul li {
float: left;
width:114px;
background: url(2014-03-08_223754.png) no-repeat right center;
text-align:center;
}
ul a {
color:#fff;
padding: 0 4px;

text-decoration: none;
}





  • Menu

  • Beer

  • Spirits

  • Cola

  • Lemonade

  • Tea

  • Coffee




转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/216966.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号