身高和文字响应能力问题
我正在为客户的网站上工作,而我一直在研究的“头部英雄”部分响应迅速,除非我在调整高度时对文本的问题重叠。如何缩小文本或制作文本,以使其在其部分的流中?
HTML:
<header class="hero">
<div class="hero-text">
<li><a href="#">Meet Us</a></li>
<span> | </span>
<li><a href="#">Join Us</a></li>
<span> | </span>
<li><a href="#">Contact</a></li>
</div>
</header>
CSS:
.hero {
background-image: url('../image/people.jpg');
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
width: 100%;
height: 90vh;
}
.hero-text {
text-align: center;
position: absolute;
display: block;
top: 65%;
left: 0;
right: 0;
text-transform: uppercase;
}
.hero-text li {
padding: 20px 0;
margin: 0 auto;
}
.hero-text li a {
color: white;
padding: 5px;
font-size: 1.5rem;
border-bottom: 1px solid white;
width: 50%;
}
span {
display: none;
}
这是网站的屏幕截图: ScreenShot
I'm working on a website for a client and the head hero section I've been working on is responsive except I'm having issues with the text overlapping the section below it whenever adjusting the height. How can I shrink the text or make it so it's in the flow of its section?
HTML:
<header class="hero">
<div class="hero-text">
<li><a href="#">Meet Us</a></li>
<span> | </span>
<li><a href="#">Join Us</a></li>
<span> | </span>
<li><a href="#">Contact</a></li>
</div>
</header>
CSS:
.hero {
background-image: url('../image/people.jpg');
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
width: 100%;
height: 90vh;
}
.hero-text {
text-align: center;
position: absolute;
display: block;
top: 65%;
left: 0;
right: 0;
text-transform: uppercase;
}
.hero-text li {
padding: 20px 0;
margin: 0 auto;
}
.hero-text li a {
color: white;
padding: 5px;
font-size: 1.5rem;
border-bottom: 1px solid white;
width: 50%;
}
span {
display: none;
}
Here is a screenshot of the website:
Screenshot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的代码存在一些语法问题(UL缺失,您应该始终在UL中使用LI标签。其重叠的原因是因为90VH是绝对位置的英雄文本的关系。我会做follwing:
Your Code has some syntax issues (ul missing and you should always use only li tags in your ul. The reason why its overlapping is because of the 90vh which is the relation for the absolute positioned hero text. I would do follwing: