新手CSS问题。我认为width:auto
对于display:block
元素意味着'填充可用空间'。然而,对于<input>
元素来说,这似乎并不是这种情况。例如:然后宽度:自动为<input>字段
<body>
<form style='background-color:red'>
<input type='text' style='background-color:green;display:block;width:auto'>
</form>
</body>
两个问题:
有没有的到底是什么宽度的定义:汽车意味着什么? CSS规范对我来说似乎很模糊,但也许我错过了相关章节。
有没有办法实现我的输入字段的预期行为 - 即。像其他块级别的元素填充可用空间吗?
谢谢!
[input with display:block is not a block,why why?](http://stackoverflow.com/questions/1030793/input-with-displayblock-is-not-a-block-why-不) – Phrogz 2011-01-07 03:26:28
@Progrog是的,它是重复的。我搜查了但没有找到它。谢谢。 – richb 2011-01-07 03:44:00