日期:2014-05-17  浏览次数:20720 次

新手求助啊,DREAMWRAVER中怎么在不同显示器上固定元素位置啊
我添加了个DIV层 里面放了FLASH 在17寸的电脑上定好了位置 放在22寸屏幕上位置就变了呀 请问怎么办啊
这里是代码
.F1 {
position: absolute;
height: 500px;
width: 800px;
top: 2870px;
left: 139px;
}
.F2 {
position: absolute;
height: 500px;
width: 800px;
top: 3247px;
left: 139px;
}


------解决方案--------------------
给父容器定义
width: ;
position:relative;
margin:0 auto;

子元素再来 absolute
------解决方案--------------------
HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head>
<body>
<div style="background:red; width:600px; height:300px; position:absolute; left:50%; top:50%; margin-top:-150px; margin-left:-300px"> 在显示器中水平垂直居中<br />
    margin-top:-150px; 高度的一半<br />
    margin-left:-300px 宽度的一半<br />
</div>
</body>
</html>