簡體   English   中英

從 HTML 列表項中刪除項目符號

[英]Remove bullet points from HTML list items

如何從#box5#box6#box7刪除項目符號? 我以為是使用#box5 a ,但它不起作用。

HTML

<div id="con3">
    <!-- irrelevant markup omitted -->

    <div id="box5">
        <li><a href="#">LIAM PRICE<br>Australia</a></li>
    </div>

    <div id="box6">
        <li><a href="#">JESS KWARTZ<br>Germany</a></li>
    </div>

    <div id="box7">
        <li><a href="#">ALI JAB<br>Mexico</a></li>
    </div>
</div>

CSS

#box5 {
    margin-left: 110px;
    margin-top: 10px; 
    font-family: 'pt_serifitalic';
    font-size: 9pt;
    line-height: 16px;  
}

#box5 a {
    color:white;
    text-decoration: none;
    list-style: none;   
}

您需要將list-style:none放在父容器上,例如

#box5, #box6, #box7{
  list-style: none;
  }

或直接應用於li元素

li{
  list-style: none;
}

另外,用ul元素包圍你的li元素

 #con3 { width:1024px; height:680px; background-color: #161717; background-image: url(media/blogs5.png); background-repeat: no-repeat; background-position: 55px; float:none; text-decoration:none; } #box4 { float:none; width:300px; height:195px; margin-left:580px; padding-top:60px; } #box5 { margin-left: 110px; margin-top: 10px; font-family: 'pt_serifitalic'; font-size: 9pt; line-height: 16px; } #box5 a { color:white; text-decoration: none; list-style: none; } #box5, #box6, #box7{ list-style: none; }
 <div id="con3"> <div id="box4"> <span class="fontheading">SHARE, INSPIRE <br>AND CONNECT </span><br><hr class="white"><br> <span class="font1">You&#39;ll follow your<br> friends and make <br>new ones as you discover the world through the<br>Amalfi travellor.</span> <br><br><span class="font2">Read and post blogs,<br> ask questions <br>and recieve answers </span> </div> <ul id="box5"> <li><a href="#">LIAM PRICE<br>Australia</a></li> </ul> <ul id="box6"> <li><a href="#">JESS KWARTZ<br>Germany</a></li> </ul> <ul id="box7"> <li><a href="#">ALI JAB<br>Mexico</a></li> </ul> </div>

您應該將列表項LI放在ULOLmenu以遵循 HTML 規范。 見這里: http : //www.w3.org/TR/html-markup/li.html

子彈在ULOL的所有LI ,因此我們可以通過以下方式修復它:

UL {list-style: none}

由於繼承,這種樣式將被轉移到 LI 元素的“列表樣式”。

另請參閱W3C示例。

子彈在LI ,所以:

li {list-style: none}

將列表項類設置為: list-style:none

如果要刪除#box5、#box6 和#box7 的項目符號

然后用這個

#box5, #box6, #box7 {

        list-style:none;
    }

但是你應該在ul使用li標簽在語法上是正確的,然后使用下面的代碼

ul li {

            list-style:none;
        }

暫無
暫無

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

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