gpt4 book ai didi

html - CSS infline-flex : text overlap

转载 作者:行者123 更新时间:2023-12-04 14:50:31 25 4
gpt4 key购买 nike

我正在尝试制作一个 footer,左侧是我的名字,homeportfoliocontact 右边的链接。但是我的链接相互重叠,我不知道是什么原因造成的。我试过 justify-content:space-around 但它们仍然重叠,而且我完全卡住了,因为我是 CSS 的新手。

问题图片 Picture of problem

HTML:

<div class="footer-nav">
<h3>Name</h3>
<ul class='nav'>
<li><a href="#">Home</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contact">Contact</a></li>

</ul>
</div> <!-- end of div class "footer-nav"-->

CSS:


.footer-nav {
border-top: 1px solid lightgrey;
padding: 1.5625em 0;
display: flex;
flex-direction: row;
justify-content: space-between;
}

.footer-nav h3 {
display: inline-flex;
font-size: 1em;
padding-right: 6.7em;
list-style-type: none;

}
.nav{
display: inline-flex;
flex-direction: row;
justify-content: space-between;
padding-left: 0px;
padding-right: 0px;
}

最佳答案

只需添加边距,然后试试这个:

.footer-nav {
border-top: 1px solid lightgrey;
padding: 1.5625em 0;
display: flex;
flex-direction: row;
justify-content: space-between;
}

.footer-nav h3 {
display: inline-flex;
font-size: 1em;
padding-right: 6.7em;
list-style-type: none;
}

.nav {
display: inline-flex;
flex-direction: row;
justify-content: space-between;
padding-left: 0px;
padding-right: 0px;
}

li {
margin: 0 20px;
}
<div class="footer-nav">
<h3>Name</h3>
<ul class='nav'>
<li><a href="#">Home</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contact">Contact</a></li>

</ul>
</div>
<!-- end of div class "footer-nav"-->

关于html - CSS infline-flex : text overlap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69139770/

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