【发布时间】:2020-11-15 07:43:27
【问题描述】:
我在一个业余网站上工作,我创建了 2 个相互重叠的 <div>(2 个矩形),当悬停处于活动状态时,我还想在较低的 <div> 上显示垂直文本,但我尝试了不同的方法,但是无法弄清楚如何做到这一点。
#rectangle2 {
background-color: #fd9e0e;
width: 700px;
height: 500px;
margin-left: 0px;
opacity: 1;
transition: 0.73s;
}
#rectangle {
width: 650px;
height: 500px;
background-color: #147906;
}
#rectangle text {
display: none;
text-transform: uppercase;
font-size: 18px;
margin-left: 0px;
writing-mode: vertical-rl;
text-orientation: upright;
}
#rectangle2:hover {
margin-left: 70px;
}
#rectangle2:hover text {
display: block;
}
<div id="rectangle">
<text>SUMMER</text>
<div id="rectangle2"></div>
</div>
【问题讨论】:
-
我假设您的意思是“仅使用 HTML 和 CSS 显示文本”?因为你可以使用 JavaScript