Html 里面有表格的字段集。如何将它们放在同一条线上?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6767474/
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
Fieldsets with tables inside. How to put them on the same line?
提问by iLemming
I need to align two <fieldset>
objects on the same line in partial view form. Whatever I do nothing helps. Trying to float them to the left, to the right, tried to minimize the width, tried display:inline
option.
我需要以<fieldset>
局部视图形式在同一行上对齐两个对象。无论我做什么,都无济于事。尝试将它们向左浮动,向右浮动,尝试最小化宽度,尝试display:inline
选项。
Without tables it works. With them - doesn't.
没有表格就可以工作。与他们 - 没有。
UPD: Or it might be something to do with qTip within which I'm trying to place those.
UPD:或者它可能与我试图将它们放置在其中的 qTip 有关。
回答by Jonathan Fingland
It's not tabular data, so why are you using a table?
它不是表格数据,那么为什么要使用表格呢?
There are numerous css fieldset examples to use to make nice looking fieldsets using labels and inputs appropriately. (See http://www.pixy.cz/blogg/clanky/css-fieldsetandlabels.htmland http://www.sitepoint.com/fancy-form-design-css-4/for two quick examples)
有许多 css 字段集示例可用于适当地使用标签和输入来制作漂亮的字段集。(有关两个快速示例,请参阅http://www.pixy.cz/blogg/clanky/css-fieldsetandlabels.html和http://www.sitepoint.com/fancy-form-design-css-4/)
If you then want to have the two fieldsets arranged horizontally, you can use display: inline-block
如果您想将两个字段集水平排列,则可以使用 display: inline-block
回答by Dineshgaru
Fieldset works with the tables. Remove any style part in the table tag. try this example. It works for me.
Fieldset 与表一起工作。删除 table 标记中的任何样式部分。试试这个例子。这个对我有用。
<fieldset id="fieldset3" style="padding:20px;top:230px; position: absolute;">
<legend>Search Results</legend>
<form>
<table id="EmployeeDetails" border="1" cellpadding="3%">
<tr>
<th>Name</th>
<th>Case Status</th>
<th>Click here to View </th>
</tr>
<tr>
<td>Dinesh</td>
<td>Occupied</td>
<td><button type="submit" id="Search">Search</button></td>
</tr>
</table>
</form>
</fieldset>