安装< fieldset>到CSS的内容大小? [英] Fitting a <fieldset> to the size of its content with CSS?
本文介绍了安装< fieldset>到CSS的内容大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是小提琴。
我需要< fieldset>
其内容的宽度,而不是其父。
I need to make the <fieldset>
the width of its contents, rather than its parent. Is there a good way to do this?
推荐答案
你想要一个收缩包装吗?
You want a shrinkwrap?
HTML
<div>
<form>
<fieldset>
<legend>Hey</legend>
<table>
<thead><tr><td>H1</td><td>H2</td></tr></thead>
<tbody><tr><td>A1</td><td>B2</td></tr>
<tr><td>A2</td><td>B9</td></tr></tbody>
</table>
</fieldset>
</form>
</div>
CSS
fieldset{
border: solid 2px blue;
float:left;
}
table{
border: solid 2px red;
}
div{
width: 80%;
overflow:hidden;
border: solid 2px purple;
padding: 1em;
}
输出
这篇关于安装< fieldset>到CSS的内容大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文