li的簡單應(yīng)用
更新時(shí)間:2007年03月12日 00:00:00 作者:
作者:eoe
雖然自己天天寫CSS~~
可是來了原創(chuàng)文章這里~~不知道要寫什么~~
今天就先寫個(gè)LI 的簡單應(yīng)用~~以后慢慢加好了
這是一個(gè)普通的LI
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>li的簡單應(yīng)用</title>
</head>
<body>
<div id="test">
<ul>
<li>測試列表的
</li>
<li>測試列表的
</li>
<li>測試列表的
</li>
<li>測試列表的
</li>
</ul>
</div>
</body>
</html>
提示:你可以先修改部分代碼再運(yùn)行
加了點(diǎn)CSS樣式定義可以這樣
引用:
*{margin:0;padding:0;} 習(xí)慣性把所有的元素的內(nèi)補(bǔ)丁外補(bǔ)丁定義為0
0可以沒有單位~~理論上是要單位的~不過0px 0pt 0em 都是0 所以~懶了~~
#test ul li 是 包含選擇符
定義ID為test 里面的ul里的li
margin:~在基本所有的瀏覽器解析都是一樣~
這里之所有要寫兩個(gè)是因?yàn)閪
在li里面有我用到border,IE5.x對border的解析與其他瀏覽器不一樣
margin/**/: 這樣的話~IE5.x是不認(rèn)識的~~
當(dāng)然還有其他的寫法如:
voice-family : "\"}\"";voice-family :inherit;等~
可參考http://bbs.51js.com/viewthread.php?tid=50475&fpage=1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>li的簡單應(yīng)用</title>
<style type="text/css">
*{margin:0;padding:0;}
#test
{
width:300px;
margin:5px;
}
#test ul li
{
margin:3px;/* for IE5.x*/
margin/*\*/:1px;
list-style-type:none;
font:normal normal normal ಌpx/2em helvetica,Arial, verdana;
border:1px #004080 solid;
background: #fefefe url('http://bbs.51js.com/images/smilies/icon1.gif') no-repeat left center;
padding-left:20px;
}
</style>
</head>
<body>
<div id="test">
<ul>
<li>測試列表的
</li>
<li>測試列表的
</li>
<li>測試列表的
</li>
<li>測試列表的
</li>
</ul>
</div>
</body>
</html>
提示:你可以先修改部分代碼再運(yùn)行
再加上類如日期之類的內(nèi)容
引用:
span定義為float:right 他會(huì)跟在后面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>li的簡單應(yīng)用</title>
<style type="text/css">
*{margin:0;padding:0;}
#test
{
width:300px;
margin:5px;
}
#test ul li
{
margin:3px;/* for IE5.x*/
margin/*\*/:1px;
list-style-type:none;
font:normal normal normal ಌpx/2em helvetica,Arial, verdana;
border:1px #004080 solid;
background: #fefefe url('http://bbs.51js.com/images/smilies/icon1.gif') no-repeat left center;
padding-left:20px;
}
#test ul li span
{
margin:0px 5px;
float:right;
}
</style>
</head>
<body>
<div id="test">
<ul>
<li><span>12-11</span>測試列表的
</li>
<li><span>12-11</span>測試列表的
</li>
<li><span>12-11</span>測試列表的
</li>
<li><span>12-11</span>測試列表的
</li>
</ul>
</div>
</body>
</html>
提示:你可以先修改部分代碼再運(yùn)行
再加更多的內(nèi)容
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>li的簡單應(yīng)用</title>
<style type="text/css">
*{margin:0;padding:0;}
#test
{
width:300px;
margin:5px;
}
#test ul li
{
margin:3px;/* for IE5.x*/
margin/*\*/:1px;
list-style-type:none;
font:normal normal normal ಌpx/1em helvetica,Arial, verdana;
border:1px #004080 solid;
}
#test ul li h4
{
font:normal normal normal ಌpx/2em helvetica,Arial, verdana;
padding-left:20px;
background: #fefefe url('http://bbs.51js.com/images/smilies/icon1.gif') no-repeat left center;
}
#test ul li p
{
padding:2px;
}
#test ul li span
{
margin:0px 5px;
float:right;
}
</style>
</head>
<body>
<div id="test">
<ul>
<li><h4><span>12-11</span>測試列表的</h4>
<p>測試列表的測試列表的測試列表的測試列表的測試列表的</p>
</li>
<li><h4><span>12-11</span>測試列表的</h4>
<p>測試列表的測試列表的測試列表的</p>
</li>
<li><h4><span>12-11</span>測試列表的</h4>
<p>測試列表的測試列表的測試列表的</p>
</li>
<li><h4><span>12-11</span>測試列表的</h4>
<p>測試列表的測試列表的測試列表的</p>
</li>
</ul>
</div>
</body>
</html>
雖然自己天天寫CSS~~
可是來了原創(chuàng)文章這里~~不知道要寫什么~~
今天就先寫個(gè)LI 的簡單應(yīng)用~~以后慢慢加好了
這是一個(gè)普通的LI
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>li的簡單應(yīng)用</title>
</head>
<body>
<div id="test">
<ul>
<li>測試列表的
</li>
<li>測試列表的
</li>
<li>測試列表的
</li>
<li>測試列表的
</li>
</ul>
</div>
</body>
</html>
提示:你可以先修改部分代碼再運(yùn)行
加了點(diǎn)CSS樣式定義可以這樣
引用:
*{margin:0;padding:0;} 習(xí)慣性把所有的元素的內(nèi)補(bǔ)丁外補(bǔ)丁定義為0
0可以沒有單位~~理論上是要單位的~不過0px 0pt 0em 都是0 所以~懶了~~
#test ul li 是 包含選擇符
定義ID為test 里面的ul里的li
margin:~在基本所有的瀏覽器解析都是一樣~
這里之所有要寫兩個(gè)是因?yàn)閪
在li里面有我用到border,IE5.x對border的解析與其他瀏覽器不一樣
margin/**/: 這樣的話~IE5.x是不認(rèn)識的~~
當(dāng)然還有其他的寫法如:
voice-family : "\"}\"";voice-family :inherit;等~
可參考http://bbs.51js.com/viewthread.php?tid=50475&fpage=1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>li的簡單應(yīng)用</title>
<style type="text/css">
*{margin:0;padding:0;}
#test
{
width:300px;
margin:5px;
}
#test ul li
{
margin:3px;/* for IE5.x*/
margin/*\*/:1px;
list-style-type:none;
font:normal normal normal ಌpx/2em helvetica,Arial, verdana;
border:1px #004080 solid;
background: #fefefe url('http://bbs.51js.com/images/smilies/icon1.gif') no-repeat left center;
padding-left:20px;
}
</style>
</head>
<body>
<div id="test">
<ul>
<li>測試列表的
</li>
<li>測試列表的
</li>
<li>測試列表的
</li>
<li>測試列表的
</li>
</ul>
</div>
</body>
</html>
提示:你可以先修改部分代碼再運(yùn)行
再加上類如日期之類的內(nèi)容
引用:
span定義為float:right 他會(huì)跟在后面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>li的簡單應(yīng)用</title>
<style type="text/css">
*{margin:0;padding:0;}
#test
{
width:300px;
margin:5px;
}
#test ul li
{
margin:3px;/* for IE5.x*/
margin/*\*/:1px;
list-style-type:none;
font:normal normal normal ಌpx/2em helvetica,Arial, verdana;
border:1px #004080 solid;
background: #fefefe url('http://bbs.51js.com/images/smilies/icon1.gif') no-repeat left center;
padding-left:20px;
}
#test ul li span
{
margin:0px 5px;
float:right;
}
</style>
</head>
<body>
<div id="test">
<ul>
<li><span>12-11</span>測試列表的
</li>
<li><span>12-11</span>測試列表的
</li>
<li><span>12-11</span>測試列表的
</li>
<li><span>12-11</span>測試列表的
</li>
</ul>
</div>
</body>
</html>
提示:你可以先修改部分代碼再運(yùn)行
再加更多的內(nèi)容
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>li的簡單應(yīng)用</title>
<style type="text/css">
*{margin:0;padding:0;}
#test
{
width:300px;
margin:5px;
}
#test ul li
{
margin:3px;/* for IE5.x*/
margin/*\*/:1px;
list-style-type:none;
font:normal normal normal ಌpx/1em helvetica,Arial, verdana;
border:1px #004080 solid;
}
#test ul li h4
{
font:normal normal normal ಌpx/2em helvetica,Arial, verdana;
padding-left:20px;
background: #fefefe url('http://bbs.51js.com/images/smilies/icon1.gif') no-repeat left center;
}
#test ul li p
{
padding:2px;
}
#test ul li span
{
margin:0px 5px;
float:right;
}
</style>
</head>
<body>
<div id="test">
<ul>
<li><h4><span>12-11</span>測試列表的</h4>
<p>測試列表的測試列表的測試列表的測試列表的測試列表的</p>
</li>
<li><h4><span>12-11</span>測試列表的</h4>
<p>測試列表的測試列表的測試列表的</p>
</li>
<li><h4><span>12-11</span>測試列表的</h4>
<p>測試列表的測試列表的測試列表的</p>
</li>
<li><h4><span>12-11</span>測試列表的</h4>
<p>測試列表的測試列表的測試列表的</p>
</li>
</ul>
</div>
</body>
</html>
相關(guān)文章
什么叫標(biāo)準(zhǔn)網(wǎng)頁設(shè)計(jì)?
什么叫標(biāo)準(zhǔn)網(wǎng)頁設(shè)計(jì)?...2007-03-03
CSS網(wǎng)頁布局入門教程11:帶當(dāng)前標(biāo)識的標(biāo)簽式橫向?qū)Ш綀D片美化版
CSS網(wǎng)頁布局入門教程11:帶當(dāng)前標(biāo)識的標(biāo)簽式橫向?qū)Ш綀D片美化版...2007-09-09
詳細(xì)分析css float 屬性以及position:absolute 的區(qū)別
相信很多人都有這樣的問題,在頁面布局中float和position:absolute哪個(gè)更好用呢?既然是布局,就用float好,這個(gè)我比較常用。這個(gè)浮動(dòng)是可以清除的,一般不會(huì)影響整體布局。 而position,定位,是不受約束的,這個(gè)貌似都談不上布局了,一般要是做什么特殊的定位或者浮動(dòng)層的時(shí)候,可以考慮使用。正常頁面布局,我個(gè)人建議用FLOAT2014-05-05
Lesson01_04 格式標(biāo)簽與文本標(biāo)簽
Lesson01_04 格式標(biāo)簽與文本標(biāo)簽...2007-02-02
驚現(xiàn)學(xué)習(xí)CSS應(yīng)該注意的方法
驚現(xiàn)學(xué)習(xí)CSS應(yīng)該注意的方法...2007-09-09
FIF互動(dòng)幫助手冊系列-HTML手冊 flash版
FIF互動(dòng)幫助手冊系列-HTML手冊 flash版...2007-03-03

