HTML如何调整Button的位置,如 靠左,居中,靠右等。

html-css016

HTML如何调整Button的位置,如 靠左,居中,靠右等。,第1张

html中设置按钮的位置:

解决方案一:

如果是绝对定位,可以设置left,还可通过margin,padding等;

" style="box-sizing: border-boxmargin: 0pxpadding: 0pxfont-family: Menlo, Monaco, Consolas, "Courier New", monospacecolor: rgb(51, 51, 51)font-size: 18.6773pxfont-style: normalfont-variant-ligatures: normalfont-variant-caps: normalfont-weight: normalletter-spacing: normalorphans: 2text-align: starttext-indent: 0pxtext-transform: nonewidows: 2word-spacing: 0px-webkit-text-stroke-width: 0pxbackground-color: rgb(255, 255, 255)"><td style="padding-right:30px"><input type="submit" value="注册"><input type="reset" value="重置"></td></tr>

解决方案二:

如果是绝对定位,可以设置left,还可通过margin,padding等。

参考资料

阿里云.阿里云[引用时间2018-1-9]

两种解决方案:

按照百分比来做(此方案不做详细描述)

固定两侧中间为100% 然后用margin减去左右两侧的

<div style="width:100% margin:0 auto"> 

       <div style="width:50px float:left">

<input type="button" value="left" style="width:100%"/>

   </div>

   <div style="width:50px float:right">

<input type="button" value="right" style="width:100%"/>

   </div>

       <div style="margin:0 50px 0 50px">

<input type="button" value="center" style="width:100%"/>

   </div>

    </div>

左边可以是任意HTML,右边用框架,并设置名称:

如:

<div id="left">

<a href="a.html" target="mainframe">查看</a>

</div>

<div id="right">

<iframe name="mainframe" id="mainframe"></iframe></div>

最简单的方法如上。