我已经问过这个问题,但我没有得到具体的答案。所以我想问一个简化版的问题
我正在制作一个网站,并希望将 div 放置在特定的高度。我无法以 px 术语设置 margin-top,就好像浏览器窗口重新调整大小一样,div 保持在该 px。我已经在 % 中指定了这个。如果 margin-top 以 px 为单位,则在所有浏览器中都可以,但如果它以 % 为单位,则 IE9 IE10 和 FF 表现得很疯狂。
下面的代码非常简单,没有什么困难。我什至尝试过重置 css,但没有做对。任何人都可以花点时间帮助我。
我目前正在从硬盘而不是从互联网加载页面。
谢谢
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Train of Thought</title>
<style type="text/css">
div.content {
height:200px;
visibility:visible;
border-style: none;
display: block;
position: fixed;
text-align: center;
z-index: 1;
padding-top: 0px;
border-top: 0px;
padding-bottom: 0px;
border-bottom: 0px;
background-color: #00FFFF;
font-family:Arial,sans-serif;
overflow: auto;
margin-left: 23%;
margin-right:25%;
font-size:150%;
margin-top: 40%;
}
</style>
</head>
<body>
<div class="content">This div is supposed to be same in all the browsers. but thisis different in them. IE9 and FF display it in lower bottom of the page while chrome displays in the middle.
<br>This div is supposed to be same in all the browsers. but thisis different in them. IE9 and FF display it in lower bottom of the page while chrome displays in the middle.
</div>
</body>
</html>