【发布时间】:2015-05-03 10:57:11
【问题描述】:
如果有人能帮助我解决以下“问题”,我将不胜感激。
我有一个文本项目列表(“文本”);每个文本都指一个图像
目的是让图像出现在“图像”
中,当鼠标在相关文本上时
这是我能做的最好的......
<html>
<head><style>
div { border: solid 1px #000; margin: 0 auto;}
#image { width: 250px;
float: right;
margin-top: 0px;
display: none; }
#text { width: 750px;
float: left; }
#text:hover + #image { display: block; }
</style></head>
<body>
<div style="width: 1004px; height: 500px; background-color:#dedede;">
<div id="text">Text-1 </div>
<div id="image"><img src="image-1.jpg" width=250px/></div>
<div id="text">Text-2</div>
<div id="image"><img src="image-2.jpg" width=250px/></div>
</div>
</body></html>
...问题是:如何让图像始终出现在其
的顶部,而不跟随文本?
提前非常感谢!
【问题讨论】:
-
您是在问如何使图像出现在文本之前?如果是这样,只需颠倒 div 的顺序,以便图像 div 首先是文本 div。
-
谢谢楼上...我试图将图像锚定到其 的顶部。