我的 html/css 有问题
我收到了一些类似的短信
hey-1title
hey test
hey-2title
hey2test
hey-3title
hey3test
hey-4title
hey4test
hey-5title
hey5test
我只想显示 hey test 并隐藏 hey2test hey3test hey4test hey5test。并且,它们的标题为 hey2 hey3 hey4 hey5
喜欢,
hey-1title
hey test
只会显示。
休息赢了,但只有头衔
当我将鼠标移动到另一个标题时 hey test 消失并且 hey2test 将显示(如果我将鼠标移动到 hey-2title。
其他的也一样。
最佳答案
试试这个
<html>
<head>
<title>Head</title>
<style>
.text{
display:none;
}
.title:hover+.text{display:block}
</style>
</head>
<body>
<div class="title">hey-1title</div>
<div class="text">hey test</div>
<div class="title">hey-2title</div>
<div class="text">hey2 test</div>
<div class="title">hey-3title</div>
<div class="text">hey3 test</div>
<div class="title">hey-4title</div>
<div class="text">hey4 test</div>
<div class="title">hey-5title</div>
<div class="text">hey5 test</div>
</body>
</html>
关于html - 在 css/html 中显示隐藏内容文本悬停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17503031/