如何使一个固定的div元素与css? [英] How to make a fixed div element with css ?
本文介绍了如何使一个固定的div元素与css?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要创建 div
元素,它始终位于所有其他元素之上的右上角。
I need to create div
element that would always be at the top right corner above all other elements
这是我尝试的
<div id="prompt" style=" height:50px; width:50px; background: #F00; position: fixed; top: 150px; margin-left: 948px; z-index: 9999">Test</div>
我需要它来处理 IE8
推荐答案
通过移除 margin-left:948px;
并添加 right:0px;
,您的 #prompt
div将位于屏幕右侧IE 8和在主要的浏览器,我相信(火狐确认)。
By removing margin-left: 948px;
and adding right: 0px;
, your #prompt
div will position itself on the right side of the screen in IE 8 and in major browsers as well I believe (Firefox confirmed).
这篇关于如何使一个固定的div元素与css?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文