在我正在設計的頁面上,我有一個帶有一個輸入類型文本的表單。通常情況下,這種格式和輸入在我的瀏覽器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;
}
檢查http://validator.w3.org和http://hsivonen.iki.fi/doctype – BalusC 2010-04-11 16:14:13