有没有办法将div置于体内,居中,给定的左右边距等于x和上下边距,等于y?除了div(及其子代)之外,文档中没有任何内容.
UPDATE.我想要以下内容:

此外,我很高兴有一个更常见的解决方案,当x1!= x2,y1!= y2时(虽然我的特殊情况解决方案x1 == x2,y1 = = y2).
您可以使用固定定位。但是,它在 IE6 中不起作用。
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='de' lang='de'>
<head>
<meta charset='utf-8' />
<title>Test</title>
<style>
#bla {
position: fixed;
top: 30px;
left: 60px;
right: 60px;
bottom: 30px;
background: yellow;
}
</style>
</head>
<body>
<div id='blah'>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
看到它在行动:http : //obda.net/stackoverflow/position-fixed.html
| 归档时间: |
|
| 查看次数: |
22041 次 |
| 最近记录: |