我试图在不添加 div 标签的情况下将按钮与输入框对齐。我可以只通过 CSS 来实现吗?我在 input.submit 上尝试了 margin-top 和 padding-top 但它不起作用?
这是 CSS:
#outer {
width: 50%;
display: table; /*padding: 1em 0 0; */
background: green;
}
#inner {
display: table-cell;
/*width: 100%;*/
background: red;
}
input {
width: 100%;
/*padding: .5em 1em;*/
}
这是 HTML:
<div id='outer'>
<div id='inner'>
<label>Eat</label>
<input type='textbox'></input>
</div>
<input class='button_submit' type='submit'></input>
</div>
最佳答案
将您的 css 中的 input
更改为 input[type=submit]
关于css - 如何在不添加任何 div 的情况下对齐表格显示中的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21995333/