【发布时间】:2023-04-06 03:15:01
【问题描述】:
为什么表单输入字段比其父 div 宽?宽度应用于文本 div,但不适用于其中包含表单字段的 div。为什么会这样?
.parent {
width: 400px;
background-color: yellow;
}
.left {
display: inline-block;
width: 50%;
background-color: red
}
.right {
display: inline-block;
width: 30%;
background-color: blue
}
<div class="parent">
<div class="left">This is text</div>
<div class="right"><input type="text"></div>
<div class="left">This is text</div>
<div class="right">text</div>
</div>
【问题讨论】:
标签: css width form-fields