刷新页面时,我的表单输入有时会移动?
问题描述:
在我正在设计的页面上,我有一个带有一个输入类型文本的表单。通常情况下,这种格式和输入在我的浏览器Chrome浏览器中正常显示,但偶尔它会在应该显示的位置左侧呈现大约20个像素。当我刷新页面时,它会回到原来正确的位置。刷新页面时,我的表单输入有时会移动?
我只在Chrome中测试过,所以这不是一个跨浏览器的问题(它发生在同一浏览器中)。我的代码下面有什么问题吗?
这里是我的HTML代码:
<!DOCTYPE htmls>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="style.css" type="text/css" />
<title>Test Site</title>
</head>
<body >
<div id="supercontainer" class="style1">
<img class="floater" src="top.jpg" alt="Top" />
<img class="floater" src="left.jpg" alt="Left" />
<div id="content">
<p id="theText">
Welcome. Please type a username.
</p>
<form id="prompt">
<div><input type="text" name="promptLine" autocomplete="off" id="promptLine" onkeypress="return submitenter(event);" value="% " /></div>
</form>
</div>
<img class="floater" src="right.jpg" alt="Right" />
<img class="floater" src="bottom.jpg" alt="Bottom" />
</div>
这里是我的CSS代码:
#supercontainer {
margin: 0 auto;
width: 900px;
display: block;
}
img.floater {
display: inline;
float: left;
}
#content {
background-color:black;
display: inline;
float: left;
padding-left:5px;
padding-right:5px;
min-height:458px;
max-height:458px;
min-width: 803px;
max-width: 803px;
color: lime;
}
#theText {
text-align:left;
margin-bottom:0;
margin-top:0;
line-height: 0.3;
font-family:"Courier New", Courier, monospace;
}
#prompt {
position: fixed;
top: 470px;
}
#promptLine {
width: 100%;
background-color: black;
color: lime;
border: none;
outline:none;
}
答
尝试关闭你的身体和HTML标记?另外,doctype“htmls”?
+0
这就是HTML的文档类型。我没有关闭这些标签,我只是没有在上面复制它。 – samoz 2010-04-11 21:01:22
+0
我从来没有听说过“htmls”。我们如何才能知道真正的错误和'没有复制它'之间的区别? – graphicdivine 2010-04-12 16:26:12
检查http://validator.w3.org和http://hsivonen.iki.fi/doctype – BalusC 2010-04-11 16:14:13