【发布时间】:2017-10-19 18:16:33
【问题描述】:
我发现了这个不错的标题 > https://codepen.io/rm/pen/ldhon 但是当我调整窗口大小时,文本重叠。在这个演示中,您必须调整窗口的大小太多,但问题是当字体大小较大或菜单中有更多文本时,它会比在此演示中更快地重叠。
HTML:
<div class="container">
<ul>
<li class="one"><a href="#">Uno</a></li><!--
--><li class="two"><a href="#">Dos</a></li><!--
--><li class="three"><a href="#">Tres</a></li><!--
--><li class="four"><a href="#">Quatro</a></li>
<hr />
</ul>
</div>
CSS:
* {
box-sizing: border-box;
}
body {
font: 300 100% 'Helvetica Neue', Helvetica, Arial;
}
.container {
width: 50%;
margin: 0 auto;
}
ul li {
display: inline;
text-align: center;
}
a {
display: inline-block;
width: 25%;
padding: .75rem 0;
margin: 0;
text-decoration: none;
color: #333;
}
.two:hover ~ hr {
margin-left: 25%;
}
.three:hover ~ hr {
margin-left: 50%;
}
.four:hover ~ hr {
margin-left: 75%;
}
hr {
height: .25rem;
width: 25%;
margin: 0;
background: tomato;
border: none;
transition: .3s ease-in-out;
}
有人可以帮我解决这个问题吗?
【问题讨论】: