html css 样式 ul li

html-css09

html css 样式 ul li,第1张

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">

<head>

  <title>鼠标移动显示</title>

  <meta http-equiv="Content-Type" content="text/htmlcharset=utf-8"/>

  <meta name="description" content=""/>

<script type="text/javascript" src="js/jquery-1.8.0.js"></script> 

<style type="text/css">

ul,li{

margin:0px

padding:0px

list-style: none

}

ul{

height:31px

border-bottom:1px solid #f46d52

}

li{

width:100px

height:30px

border-radius:5px 5px 0px 0px

border:1px solid #ccc

border-bottom:none

text-align: center

line-height: 30px

background-color:#EEEEEE

float: left

color:black

font-weight: 800

margin-left:5px

}

li:hover{

height:31px

background-color: white

color:#FDE7D2

border:1px solid #f46d52

border-bottom:none

cursor:pointer

}

</style> 

</head>

<body>

<div class="nav">

<ul>

<li>导航1</li>

<li>导航2</li>

<li>导航3</li>

</ul>

</div>

</body>

</html>

效果图:

这个只是简单的.hover事件,如果要点击得到效果那个需要写js。。。

如果是列表前面小点的形状的话就这么写

ul {list-style-type : disc}

如果是改变整个ul的形状的话

首先要申明它是块级元素。然后

ul{border-radius:100%}

1、定义不同

ul 是 Unordered List(无序列表)的缩写。<li>标签定义列表项目(li是lists的缩写)。

2、用法不同

<ul>标签定义无序列表。使用 <li>标签定义的列表可以是个无序列表也可以是有序列表。

3、支持的HTML全局属性不同

<li>标签支持所有的HTML 全局属性。<ul>标签支持 HTML 中的全局属性:accesskey、class、dir、id、lang、style、tabindex、title。

4、属性不同

<ul>标签中的属性:compact、type。<ul>标签:id, class, title, style, dir, lang, xml:lang。

5、元素级别不同

ul 是块级元素可以定义宽和高,li表示行排列不能单独使用,需要在ul和ol里面,配合使用。