li 标签自动添加项目符号,无需指定列表类型,无需编写 ol/ul 行

问题描述 投票:0回答:1

你们中的一些人能解释一下为什么当我将 li 标签添加到我的 html 文件时它会立即添加一个项目符号,即使只写了 li 开始和结束标签,仅此而已。

!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Movies</title>
    <link rel="shortcut icon" type="image/x-icon" href="X:\Downloads\favicon_play.ico"/>
</head>
<body>
    <div>
        <h2> My personal Top of Anime</h2>
        <li></li>
      <h2>My personal top of movies</h2>    
    </div>
</body>
</html>

谢谢!

我试图删除曾经在 li 下的元素,我尝试在其他 html 文件中编写,所以我可以看到我的代码的其他部分与此问题有关。

html html-lists
1个回答
0
投票

这是设计的默认行为。您可以轻松地根据需要进行修改。

ul, ul li {
      list-style-type: none;
    }

<ul>
 <li>My personal Top of Anime</li>
 <li>My personal top of movies</li>  
</ul>
© www.soinside.com 2019 - 2024. All rights reserved.