<fieldset> 在 html 中的宽度

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3663945/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 04:25:42  来源:igfitidea点击:

<fieldset>'s width in html

htmlfieldset

提问by user441940

I have an issue with the width of a fieldset. It's not auto adjusting to it's content. It sets the width to the width of the screen. Is there a way to set it to auto adjust to the width of the content of the fieldset?

我对字段集的宽度有疑问。它不是自动调整到它的内容。它将宽度设置为屏幕的宽度。有没有办法将其设置为自动调整到字段集内容的宽度?

回答by Frank van Wijk

A fieldset is as large as the parent container, just like any block-levelelement, if you do not give it a fixed width. So you have to make it display: inline-block.

一个字段集和父容器一样大,就像任何块级元素一样,如果你不给它一个固定的宽度。所以你必须做到display: inline-block

回答by David

This should work

这应该工作

    <fieldset style="width:0px">

    </fieldset>

回答by asiimire mark

Sett the width to 0
Hml:

将宽度设置为 0
Hml:

<fieldset class="field">
</fieldset>

Css:

css:

.field {
    width: 0;
}

回答by user2879678

<fieldset style="width:270px">