gpt4 book ai didi

html - 将列表保持在同一行

转载 作者:太空宇宙 更新时间:2023-11-04 14:25:37 25 4
gpt4 key购买 nike

我正在尝试制作一个列表,每行应该包含大约 5 张图片,如果有更多图片,请在下面新建一行并开始这样做。 float: left; 不起作用,因为它把一切都搞砸了。

HTML:

<html>
<head>
<title>LolChamps - Knowledge Database</title>
<link rel="stylesheet" type="text/css" href="css/champions.css">
<link rel="stylesheet" type="text/css" href="css/css.css">
<link href='http://fonts.googleapis.com/css?family=Sansita+One' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Belleza' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
</head>
<body>

<!-- NAVIGATION -->
<div id="nav-bar">
<div id="nav-bar-title">LoL Champs</div>
<ul>
<li><a href="champions">Champs</a></li>
<li><a href="">Info</a></li>
<li><a href="">Guides</a></li>
<li><a href="">Model Viewer</a></li>
<li><a href="">Lists</a></li>
<li><a href="">Support</a></li>
</ul>
</div>
<!-- END NAVIGATION -->

<div id="main-body">
<div id="nav-body-divider"></div>

<p id="home-body-title">Champions</p>

<div id="champ-list">
<ul>

<li><a href="champs/aatrox.html"><img src="images/champion-icons/aatrox.png" /><br/><div id="champ-text">Aatrox</div></a></li>
<li><a href="champs/ahri.html"><img src="images/champion-icons/ahri.png" /><br/><div id="champ-text">Ahri</div></a></li>
<li><a href="champs/akali.html"><img src="images/champion-icons/Akali.png" /><br/><div id="champ-text">Akali</div></a></li>
<li><a href="champs/alistar.html"><img src="images/champion-icons/Alistar.png" /><br/><div id="champ-text">Alistar</div></a></li>
<li><a href="champs/amumu.html"><img src="images/champion-icons/amumu.png" /><br/><div id="champ-text">Amumu</div></a></li>
<li><a href="champs/anivia.html"><img src="images/champion-icons/anivia.png" /><br/><div id="champ-text">Anivia</div></a></li>
<li><a href="champs/annie.html"><img src="images/champion-icons/annie.png" /><br/><div id="champ-text">Annie</div></a></li>

</ul>
</div>

</div>

</body>
</html>

CSS:

#champ-list {
color: black;
font-family: Arial;
}
#champ-list li {
list-style-type: none;
color: #B0B0B0;
}
#champ-list ul li {
display: inline;
}

如您所见,我尝试了 display: inline; 但无济于事。这是我希望结果如何的图片:

This si what it should sort of look like.

最佳答案

尝试

#champ-list ul li {
display: inline-block;
}

您可能需要调整 li 的宽度,以便每行适合 5 个。

关于html - 将列表保持在同一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19577526/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com