HTML代碼,我希望串列的內容是Home,collection,cart在一條直線上,而不是按列
<body>
<section class="Top-heading">
<div class="heading">
<img src="_Logo.png" alt="">
<a href="#" class="AJ">AJ<span class="Tutorials">Clothings</span></a>
<nav>
<ul class="list">
<li><a href="#">Home</a></li>
<li><a href="#">Collection</a></li>
<li><a href="#">Cart</a></li>
</ul>
</nav>
</div>
</body>
css 從這里開始,參考最后一部分,即 .list a ,還有什么要添加的,以便串列的內容在一行上。我也希望文本在右側
body {
font-family: "Comforter", cursive;
font-family: "Cormorant", serif;
background-color: white;
}
/*************************For main heading******************************/
.Top-heading {
background-color: rgb(0, 0, 0);
height: 80px;
background-size: cover;
}
.heading {
display: flex;
align-items: center;
}
.heading img {
display: block;
position: relative;
object-fit: fill;
width: 70px;
height: 70px;
background-repeat: no-repeat;
background-size: cover;
padding-top: 0px;
}
.AJ {
text-decoration: none;
z-index: 2;
color: rgb(255, 255, 255);
padding-left: 10px;
font-size: 30px;
}
.Tutorials {
z-index: 2;
color: red;
}
.list a {
color: rgb(255, 13, 13);
list-style: none;
text-decoration: none;
display: flex;
width: 100%;
text-align: center;
margin-right: 1000px;
}
uj5u.com熱心網友回復:
此代碼有效
body {
font-family: "Comforter", cursive;
font-family: "Cormorant", serif;
background-color: white;
}
.Top-heading {
background-color: rgb(0, 0, 0);
height: 80px;
background-size: cover;
}
.heading {
display: flex;
align-items: center;
justify-content: space-between;
}
.logo {
display: flex;
align-items: center;
}
.heading img {
display: block;
position: relative;
object-fit: fill;
width: 70px;
height: 70px;
background-repeat: no-repeat;
background-size: cover;
padding-top: 0px;
}
.AJ {
text-decoration: none;
z-index: 2;
color: rgb(255, 255, 255);
padding-left: 10px;
font-size: 30px;
}
.Tutorials {
z-index: 2;
color: red;
}
nav {
width: 40%;
margin-left: 54rem;
}
.list a {
color: rgb(255, 13, 13);
list-style: none;
text-decoration: none;
text-align: center;
}
.list {
display: flex;
width: 40%;
justify-content: space-between;
}
.list li {
padding-left: 1rem;
}
<body>
<section class="Top-heading">
<div class="heading">
<div class="logo">
<img src="_Logo.png" alt="LOGO">
<a href="#" class="AJ">AJ<span class="Tutorials">Clothings</span></a>
</div>
<nav>
<ul class="list">
<li><a href="#">Home</a></li>
<li><a href="#">Collection</a></li>
<li><a href="#">Cart</a></li>
</ul>
</nav>
</div>
</section>
</body>
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/425644.html
上一篇:列出nums的范圍除以N
