Html 输入类型=“文本”不调整大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1292910/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
input type="text" not resizing
提问by leora
On the page http://qa.salemgolfclub.org/Directions, there is a section at the bottom (next the the "Directions" button) that has an input
where you can put an address and use Google Maps for driving directions.
在页面http://qa.salemgolfclub.org/Directions的底部(“方向”按钮旁边)有一个部分input
,您可以在其中输入地址并使用谷歌地图获取行车路线。
One thing that I can't figure out is no matter what I enter for the size
property on the textbox, it always shows up as the same size.
我无法弄清楚的一件事是,无论我为size
文本框上的属性输入什么,它始终显示为相同的大小。
As you can see, I have it set to:
如您所见,我已将其设置为:
<input type="text" size="300" id="fromAddress" name="from" value="" />
but it clearly doesn't look this long, though it definitely looks like there is real estate left on the screen.
但它显然没有这么长,尽管它看起来确实像屏幕上留下了空间。
回答by Daniel Liuzzi
The width of the field is set by CSS. More specifically in line 319 of your Site.css, to 200 pixels. Stylesheets always higher priority than markup.
字段的宽度由 CSS 设置。更具体地说,在 Site.css 的第 319 行,为 200 像素。样式表的优先级总是高于标记。
回答by rahul
Change the width in the style
更改样式中的宽度
style="width: 100px"
It would be better to apply a css class for this particular text field and then apply the style in that class. Do avoid inline styling.
最好为此特定文本字段应用 css 类,然后在该类中应用样式。避免内联样式。
回答by Russ Cam
if you change it to
如果你把它改成
style= "width: 300px;"
then it is resized
然后调整大小
回答by knittl
you'll probably assign the width with CSS for your id #fromAddress, and CSS' width has higher priority than the attribute size
您可能会使用 CSS 为您的 id #fromAddress 分配宽度,并且 CSS 的宽度比属性大小具有更高的优先级
回答by Omar Abid
using stylizer, the property that control the size of your box is "INPUT[type="text"]". So you need to change it
使用样式器,控制框大小的属性是“INPUT[type="text"]”。所以你需要改变它
It's in your site.Css file
它在您的 site.Css 文件中
回答by Richard Lennox
In your CSS you have the width: 200px;
on input[type=text]
.
在你的CSS你有width: 200px;
上input[type=text]
。
Changing this value will allow you to change the width of the box.
更改此值将允许您更改框的宽度。