時間:2023-03-06來源:系統城裝機大師作者:佚名
普通的顯示數據的時候,ul就是項目列表,li就是列表項??梢杂脕盹@示數據。如果用于DIV+CSS布局的話,ul+li可以替換表格的作用,具體的設置,如果寬度高度、行間距、背景邊框等需要配合CSS一起設置。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns = "http://www.w3.org/1999/xhtml" > < head > < meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" /> < title >做導航</ title > < style type = "text/css" > #menu{ width:1000px; height:35px; float:right; margin:0px; clear:both; vertical-align:bottom; } #ul li{ list-style-type:none; /*去掉項目符號的,比如你用了< ul >< li ></ li >< li ></ li ></ ul >默認的li里邊的字是有列表符號的,小圓點。這個list-style-type: none就是不要列表符號*/ clear:both; width:100px; display:inline; /*li {display: inline} 讓 li 不再獨占一行, 寬度上只會得到必要的而不是占有所在容器的全寬*/ font-size: larger; text-decoration:none; } a{ text-decoration:none; /*去掉下劃線*/ } </ style > </ head > < body > < div id = "menu" > < ul id = "ul" > < li >< a title = "" href = "http://localhost:1435/BookShop/index.aspx" >首頁 </ a ></ li > < li >< a title = "" href = "http://localhost:1435/BookShop/hybooks.aspx" >行業圖書 </ a ></ li > < li >< a title = "" href = "http://localhost:1435/BookShop/Clothing.aspx" >服飾潮流 </ a ></ li > < li >< a title = "" href = "http://localhost:1435/BookShop/" >美容會所 </ a ></ li > < li >< a title = "" href = "http://localhost:1435/BookShop/" >媽咪寶貝 </ a ></ li > < li >< a title = "" href = "http://localhost:1435/BookShop/" >禮品書籍 </ a ></ li > < li >< a title = "" href = "http://localhost:1435/BookShop/" >新聞資訊 </ a ></ li > < li >< a title = "" href = "http://localhost:1435/BookShop/" >用戶留言 </ a ></ li > < li >< a title = "" href = "http://localhost:1435/BookShop/" >聯系我們 </ a ></ li > </ ul > </ div > </ body > </ html > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns = "http://www.w3.org/1999/xhtml" > < head > < meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" /> < title ></ title > < style type = "text/css" > </ style > </ head > < body > < div >默認是豎排,并且帶圓點 < ul > < li >hello</ li > < li >hello</ li > < li >hello</ li > < li >hello</ li > </ ul > </ div > </ body > </ html > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns = "http://www.w3.org/1999/xhtml" > < head > < meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" /> < title ></ title > < style type = "text/css" > </ style > </ head > < body > < div > < ul > < li style = "list-style:none;" >去掉圓點</ li > < li style = "display:inline;" >hello</ li > < li >hello</ li > < li style = "display:inline;" >hello</ li > </ ul > </ div > </ body > </ html > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns = "http://www.w3.org/1999/xhtml" > < head > < meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" /> < title >無標題文檔</ title > < style type = "text/css" > #myul li{ float:left; width:100px; } </ style > </ head > < body > <!--制作表格的原理,ul寬度為300px,li寬度為100px,則成三列--> < div style = "text-align:center;background:#eef" > < ul id = "myul" style = "width:300px;background:#eee" > < li >hello</ li > < li >hello</ li > < li >hello</ li > < li >hello</ li > < li >hello</ li > < li >hello</ li > < li >hello</ li > < li >hello</ li > < li >hello</ li > </ ul > </ div > </ div > </ body > </ html > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns = "http://www.w3.org/1999/xhtml" > < head > < meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" /> < title >無標題文檔</ title > < style type = "text/css" > #myul li{ float:left; width:100px; } </ style > </ head > < body > <!--橫向的方法,如果要居中,需要設置寬度才可以,這個寬度要和里面的li總長度一樣。--> < div style = "text-align:center;background:#def" > < ul id = "myul" style = "width:500px;background:#eee;" > < li >hello</ li > < li >hello</ li > < li >hello</ li > < li >hello</ li > < li >hello</ li > </ ul > </ div > </ body > </ html > |
到此這篇關于html中ul和li標簽的用法詳解的文章就介紹到這了
2023-03-06
dw調節一個角的角度代碼技巧 HTML怎么角度代碼調節一個角的角度?2022-12-06
dw制作虛線圓圈的技巧 html用代碼制作虛線框怎么做?2022-09-12
HTML靜態頁面獲取url參數和UserAgent的實現web應用開發使用svg圖片,總結了下,可以有如下4種方式: 1. 直接插入頁面。 2. img標簽引入。 3. css引入。 4. object標簽引入。...
2022-09-12
主要介紹了巧用 -webkit-box-reflect 倒影實現各類動效(小結),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值...
2021-04-22