我的里面有 6 个列表项ul,我正在制作一个导航菜单。因此,当屏幕尺寸低于 430 像素时,我想将所有 6 个列表项分解为两行(每行将有 3 个列表项)。
我在这里添加了代码
body {
font-family: Arial, sans-serif;
padding: 4px;
text-align: center;
}
h1 {
text-align: center;
font-weight: normal;
}
nav {
background: #f0f0f0;
border: 1px solid #ccc;
border-right: none;
width: 100%;
margin-bottom: 20px;
}
nav ul {
margin: 0;
padding: 0;
}
nav ul li {
list-style: none;
text-align: center;
border-left: 1px solid #fff;
border-right: 1px solid #ccc;
}
nav ul li:first-child {
border-left: none;
}
nav ul li a {
display: block;
text-decoration: none;
color: #616161;
padding: 10px 0;
}
nav {
display: table;
table-layout: fixed;
}
ul {
display: table-row;
}
ul li {
display: table-cell;
}
.x {
display: none;
}
.p {
text-align: center;
font-size: 14px;
margin-top: 80px;
}
.d {
color: #ccc;
}
@media (max-width: 430px) {
nav {
font-size: .8em;
}
nav ul li {
display: fluid;
border-bottom: 1px solid #ccc;
}
}
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="services.html">Services</a></li>
<li class="start"><a href="products.html">Products</a></li>
<li><a href="jobs.html">Jobs</a></li>
<li class="end"><a href="contact.html">Contact</a></li>
</ul>
</nav>
请帮帮我,谢谢

