2010-08-01 56 views
3

我的HTML代碼如何解決密碼輸入字段的大小?

<tr> 
       <td>User ID:</td> 
       <td><input type="text" id="uid" size="20"></td> 
      </tr> 
      <tr> 
       <td>Password:</td> 
       <td><input type="password" id="pass" size="20"></td> 
      </tr> 
      <tr> 

但問題是,密碼文本框長度來指出錯誤在IE瀏覽器,意味着uid尺寸爲20,但pass大小約爲17

回答

8

嘗試使用style="width:200px"例如,而不是以這種方式指定大小。

<input type="text" id="uid" style="width:200px;"> 
<input type="password" id="pass" style="width:200px;"> 

或者你可以在CSS像這樣創建一個類:

.input{ 
    width:200px; 
} 

而且使用這樣的:

<input type="text" id="uid" class="input"> 
<input type="password" id="pass" class="input"> 
1

你可以用width: 150px;修復(用CSS)。

在CSS文件:

input { 
    width: 150px; 
} 

或者內聯CSS:style="width: 150px;"

編輯:烤:)。