如何将按钮放在中间? [英] How can I put the button in the center?
本文介绍了如何将按钮放在中间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想把我的按钮放在中心,我的代码在这里:
< div style = 已删除:relative; float:left; width:250px >
< fieldset >
< 图例 > MyToys < / legend >
< div style = border-style:solid; border-color:rgb(235,235,235); >
< div id =' toydiv' style =' background:red; height:200px; width:150px; float:left' >
我的< br >
Toys < br >
列出< br >
显示< / div > ;
< div 样式 =' text-align:center ;保证金:0' >
< input type =' 按钮' value < span class =code-keyword> =' 添加' >
< / div >
< / div >
< / fieldset >
< / div < span class =code-keyword>>
我尝试添加text-align:center;保证金:0,但仍然失败。我希望结果如下图所示:图片
解决方案
Text-align将对齐文本而不是html元素。将按钮括在中心标记中[ ^ ],它会将按钮居中对齐父母容器
I want to put my button in the center,My codes is here:
<div style="removed: relative; float: left; width: 250px">
<fieldset>
<legend>MyToys </legend>
<div style="border-style: solid; border-color: rgb(235,235,235);">
<div id='toydiv' style='background: red; height: 200px; width: 150px; float: left'>
My<br>
Toys<br>
List<br>
show</div>
<div style='text-align: center; margin: 0'>
<input type='button' value='Add'>
</div>
</div>
</fieldset>
</div>
I try to add "text-align: center; margin: 0",but still fail.I want the result like this picture:picture
解决方案
Text-align will align a text and not an html element. Enclose the button within center tag[^] and it will center align the button to the parent container.
这篇关于如何将按钮放在中间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文