简体   繁体   English

并排显示不同形式的按钮

[英]Display Buttons in different form side by side

I have the following code. 我有以下代码。

<fieldset class=last>
     <button>Refresh</button>
     <button> Clear</button>
</fieldset>
<form method="POST" action="*******">
     <button> Download</button>
</form>

I want all the three buttons to be displayed side by side. 我希望所有三个按钮并排显示。 Now, the downloadd button is displayed below refresh and clear buttons. 现在,已下载的按钮显示在刷新和清除按钮下方。 How can I do that? 我怎样才能做到这一点? Here is the FIDDLE 这是FIDDLE

You can use css for that. 您可以为此使用CSS。 Just select <fieldset> and <form> and give it a inline-block like in the demo. 只需选择<fieldset><form> ,然后像演示中一样为其提供inline-block

fieldset, form {display:inline-block;}

DEMO (Your FIDDLE but updated with the Css) 演示 (您的FIDDLE,但已使用CSS更新)

In addition to the answer given by 'C Travel' if you want to keep the border and add support for IE7, you might wanna do this: 如果您想保留边框并添加对IE7的支持,除了“ C Travel”给​​出的答案以外,您可能还想这样做:

HTML HTML

<div id="container">
    <fieldset class=last id="one">
        <button>Refresh</button>
        <button> Clear</button>
    </fieldset>
        <form method="POST" action="*******" id="two">
        <button> Download</button>
    </form>
    <div id="clearer"></div>
</div>

CSS CSS

#one, #two{
    display: inline-block;
    *display: inline;
    zoom: 1;
    border: 0;
}

#container{
    border: 1px solid #000;
}

FIDDLE 小提琴

Or use floats for even wider support: 或使用浮点数提供更广泛的支持:

#one, #two{
    float: left;
    border: 0;
    padding: 10px;
}

#clearer{
    clear: both;
}

#container{
    border: 1px solid #000;
}

FIDDLE 小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM