为什么我无法更改html文章输入的大小?

问题描述:

好了,所以我想使这个更大:为什么我无法更改html文章输入的大小?

Post: <input id="postbox" type="text" rows="6" cols="40" name="post" /> 

但它不读的行列数。

这里是我的CSS:

body{ 
    text-align: center; 
    background-color: #000000; 
} 

h2{ 
    color: #0088AA; 
    padding: 0px; 
    margin: 0px; 
} 

#wrap{ 
    margin: auto; 
    margin-top: -10px; 
    margin-bottom: -10px; 
    background-color: transparent !important; 
    width: 700px; 
    height: 100%; 
    padding: 0px; 
    text-align: left; 
} 

#postbox{ 
    background-color: #444444; 
    border: 2px solid #777777; 
    color: #ffffff; 
} 

.post{ 
    padding: 5px; 
    margin-top: 10px; 
    margin-bottom: 10px; 
    background-color: #000044; 
    border: 2px solid #443300; 
    width: 100%; 
    text-align: left; 
    color: #007799; 
} 
+0

'rows'和'cols'是文字区域。对于文本框,你可以使用'width'和'height' – Quasdunk 2012-03-27 19:26:26

可能你需要一个textarea而不是input

试试这个

<textarea id="postbox" rows="6" cols="40" name="post"></textarea> 

如果你不想一个textarea(我的意思将文本保留在一行中)可以使用宽度和高度属性:

<input type='text' style='width:120px;height:50px;' /> 

首先我看不到你实际上在哪里改变CSS中input元素的width属性。

以下CSS代码是对id = postbox和type =“text”的所有输入元素的直接引用。

input#postbox[type="text"]​​​​​{ 
width: 400px; 
}​ 

查看空房此链接,看到它在行动http://jsfiddle.net/sGpAf/

编辑 这是当然的,如果你wan't使用单行文本框..如果你想使用多我强烈推荐一个textarea代替:)

喜Y可以限定sapretly输入标签选择CSS作为这样

**css** 
input[type="text"]{ 
width:200px; 
    height:30px; 
} 


**html** 

<input id="postbox" type="text" name="post" /> 

现在check to

http://jsfiddle.net/PFmU2/2/

你可能有TYPE =“搜索”,不允许高度,以在某些浏览器进行更改。

尝试将其更改为type =“text”或完全删除type属性。

<input type="search"> 
<!-- remove type attribute so it becomes --> 
<input> 

的jsfiddle:http://jsfiddle.net/pby6u94k/