我试图让图像在屏幕右下角滚过文本时出现。我如何在所有屏幕宽度和高度下调整它?无论屏幕高度/宽度如何让图像留在屏幕底部?
0
A
回答
1
这会工作:
<style type="text/css">
img.floating {
position: absolute;
bottom: 0px;
left: 0px;
}
</style>
<img class="floating" src="url to image" />
3
你可以在图像上使用固定的位置,并指定左,上,右或底部的属性来满足您的需求,请参阅:http://www.w3schools.com/css/css_positioning.asp为例
+2
http://w3fools.com/ [MDN - 定位](https://developer.mozilla.org/en/CSS/position) – Andrew 2012-04-16 21:20:23
+0
感谢指针安德鲁,我不会在将来使用它们。 – heavysixer 2012-04-16 21:42:51
0
创建CSS样式:悬停在文本上。
<style type="text/css">
#bottom { display:none; }
#text:hover #bottom {
display:block;
position:absolute;
left:0; // how far from the left
bottom:0;
}
</style>
<div id="text>TEXT</div>
<img src="bottomimage.jpg" id="bottom">
1
:hover
,除非它被一个链路上使用不适合IE6工作。用这个。
<style type="text/css">
#myFavoriteFooterImage {
bottom:0px;
right:0px;
position:fixed;
display:none;
}
</style>
<script type="javascript">
document.getElementById("mousyTextFunTime").onmouseover = function(){
document.getElementById("myFavoriteFooterImage").style.display = "";
};
document.getElementById("mousyTextFunTime").onmouseout = function(){
document.getElementById("myFavoriteFooterImage").style.display = "none";
};
</script>
<div id="mousyTextFunTime">Text to mouse over</div>
<img id="myFavoriteFooterImage" />
相关问题
- 1. Android |获取屏幕高度,宽度和屏幕宽度,高度
- 2. 屏幕宽度和高度
- 3. 查找屏幕宽度和屏幕高度在Javascript
- 4. 如何在网站底部对齐背景图片,当屏幕高度高于屏幕高度?
- 5. 宽度:100%部分屏幕?
- 6. 如何让黑莓屏幕上的标题屏幕高度?
- 7. Div采用屏幕宽度和高度
- 8. GLFW获取屏幕高度/宽度?
- 9. 获取屏幕高度和宽度
- 10. Android,获取屏幕宽度和高度?
- 11. 屏幕的高度和宽度
- 12. 屏幕宽度和高度Android
- 13. 错误的屏幕宽度和高度
- 14. Javascript屏幕宽度/高度到PHP
- 15. 获取屏幕宽度和高度
- 16. python获取屏幕宽度高度cron
- 17. Pygame屏幕宽度
- 18. JS屏幕宽度
- 19. Android Animate Scale图像以适合屏幕宽度和高度
- 20. 级图像到屏幕宽度
- 21. 背景图像宽度的屏幕
- 22. 屏幕高度 - Android
- 23. 添加屏幕宽度的一类,如果屏幕宽度小于960像素
- 24. 如何让视差滚动消耗屏幕的全部宽度和高度?
- 25. 如何动态设置div的高度到屏幕高度,直到滚动条到达屏幕底部
- 26. 如何让div自动采用屏幕上留下的高度?
- 27. HTML + CSS:在屏幕内部滚动屏幕高度
- 28. 如何在运行时计算屏幕高度和宽度?
- 29. 如何在飞镖中获取屏幕高度和宽度
- 30. 如何让Youtube嵌入适合屏幕高度,同时让其宽度溢出
就是这样。我不知道如何实施它... – 0x499602D2 2012-04-16 21:11:35
使用位置:固定。这是将元素与视口对齐的最便捷方式。 – koenpeters 2012-04-16 21:21:16