Html 如何使按钮填充表格单元格
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12362879/
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
How to make button fill table cell
提问by Red Cricket
I have this HTML ...
我有这个 HTML ...
<p align='center'>
<table width='100%'>
<tr>
<td align='center'><form><input type=submit value="click me"></form></td>
</tr>
</table>
</p>
... which results in a table and button that looks like this ...
......这会产生一个看起来像这样的表格和按钮......
... which is fine, but how would I make the button fill the entire cell?
...这很好,但我如何让按钮填满整个单元格?
Thanks!
谢谢!
回答by Solo
For starters:
对于初学者:
<p align='center'>
<table width='100%'>
<tr>
<td align='center'><form><input type=submit value="click me" style="width:100%"></form></td>
</tr>
</table>
</p>
Note, if the width of the input button is 100%, you wont need the attribute "align='center'" anymore.
请注意,如果输入按钮的宽度为 100%,您将不再需要“align='center'”属性。
This would be the optimal solution:
这将是最佳解决方案:
<p align='center'>
<table width='100%'>
<tr>
<td><form><input type=submit value="click me" style="width:100%"></form></td>
</tr>
</table>
</p>