簡體   English   中英

有沒有辦法讓html列表像這樣

[英]Is there a way to make a html list behave like this

我正在創建一個拖放座位計划。 我一直在做各種各樣的操作列表看起來像這樣:

http://puu.sh/41Td4.png

它目前看起來像這樣:

http://puu.sh/41Tcy.png

我該怎么扭轉呢? 我希望老師覺得他只是面對全班。 這可能嗎? 先感謝您!

styles.css的

body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;

}
ul {
    list-style-type:none;
    width:500px;
}
#contentLeft li {
    list-style: none;
    width: 78px;
    height: 78px;
    background-color:#2a70db;
    border: #CCCCCC solid 1px;
    color:#fff;
    float:right;
    margin: 3px 2px 0 0;
    padding: 5px 5px 5px 5px;
}

您可以使用css選擇器。 在你的情況下,第3個元素應該在一個新行上,這樣你就可以清除浮動。

代碼將是這樣的:

li:nth-child(3) {
    clear: both;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM