是什么阻止我的输入元素像块元素一样显示?
如何在输入元素上引发类似 div 的行为?具体来说,如何诱导宽度扩展,使其外部宽度(包括边距)填满容器? width: 100%
不起作用,因为它没有考虑其他盒子模型属性。
How would I induce div-like behaviour on the input element? Specifically, how can I induce the width to expand such that its outer width including margin fills up the container? width: 100%
doesn't work, because it doesn't take into account the other box model attributes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用“hack”来解释输入边框宽度,就像这样...
我的
adjustForTheInputBorder
类往往有一个更恰当地表达我对 css 的仇恨的名称...:)PS < code>div 默认情况下呈现为
display:block
,您不需要在那里。I use a "hack" to account for the input border width something like this...
My
adjustForTheInputBorder
class tends to have a name which more appropriately conveys my hatred of css though... :)P.S.
div
renders asdisplay:block
by default, you don't need that there.