gpt4 book ai didi

html - 如何对齐侧边栏中的 anchor 链接和列表?

转载 作者:行者123 更新时间:2023-11-28 17:10:09 24 4
gpt4 key购买 nike

body {
margin: 0px;
font-family: verdana, georgia;
overflow-x: hidden;
}


/*****************Blocks*********************/

.navbar {
background-color: #fff;
height: 90px;
width: 100%;
top:0px;
margin-left: 250px;
}

.topContent {
background-color: #eceff1;
height: 200px;
width:100%;
margin-left: 250px;
}

.mainContent {
background-color: #e5e5e5;
height: 800px;
width:800px;
margin-left: 250px;

}
.leftSideNav1 {
height: 100%;
width: 80px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #37474f;

}
.leftSideNav2 {
height: 100%;
width: 200px;
position: fixed;
z-index: 1;
top: 0;
left: 80px;
background-color: #263238;
text-decoration: none;

}

/*****************Elements*********************/

.leftSideNav1__lists a{
font-size: 10px;
color: #eee;
padding-top: 30px;
margin-left: 10px;
text-decoration: none;
}


.leftSideNav2 {
font-size: 12px;
}

.leftSideNav2 .leftSideNav2__lists > ul{
padding-top: 80px;
}

.leftSideNav2__lists ul {
list-style: none;
padding-bottom: 10px;
}
<body>
<div class="container">
<div class="navbar">
</div>
<div class="topContent">
</div>
<div class="mainContent">
</div>
<div class="leftSideNav1">
<div class="leftSideNav1__lists">
<!-- <i class="fa fa-home w3-large"></i> -->
<i class="Tiny material-icons">home</i><br>
<a href="#">Home</a><br>
<i class="material-icons">pause</i><br>
<a href="#">YouTubers</a><br>
<i class="material-icons">assignment</i><br>
<a href="#">Campaigns</a><br>
<i class="material-icons">message</i><br>
<a href="#">Messages</a><br>
<i class="material-icons">pause</i><br>
<a href="#">Videos</a><br>
</div>
</div>
<div class="leftSideNav2">
<div class="leftSideNav2__lists">
<ul class="leftSideNav2__list1">Videos
<li>Action Required</li>
<li>Fund YouTuber</li>
<li>Hired & Funded</li>
<li>Edit Requested</li>
</ul>
<ul class="leftSideNav2__list2">Proposals
<li>New</li>
<li>Declined</li>
<li>Changes Required</li>
<li>Changes Declined</li>
</ul>
<ul class="leftSideNav2__list3">Approvals
<li>Waiting for Approval</li>
<li>Approved / Completed</li>
<li>Video in Dispute</li>
</ul>
</div>
</div>
</div>
</body>

Codepen

我对边栏中的 anchor 链接和列表有疑问。我无法对齐 2 个侧边栏中的 anchor 链接和列表。我正在尝试应用 CSS 属性,但它们没有应用可能是由于应用的分层样式不正确。

目前,它是这样的:

Img1

但这就是我想要的样子:

img2

最佳答案

你可以设置父容器

.leftSideNav1__lists{
text-align:center;
}

还删除了每个 a 标签的左边距.. codepen

关于html - 如何对齐侧边栏中的 anchor 链接和列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46492488/

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