Html 删除 <fieldset> 边框线的最简单方法是什么?

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

What's the easiest way to remove <fieldset> border lines?

htmlcss

提问by aneuryzm

What's the easiest way to remove the borderlines of a <fieldset>?

删除 a 的边界线的最简单方法是<fieldset>什么?

I mean a cross-browser solution... is that possible ?

我的意思是跨浏览器解决方案......这可能吗?

回答by Marko

fieldset {
    border: 0;
}

回答by Amirouche Douda

fieldset {
   border:0 none;
}

回答by JohnB

(In regards to Marko'scomment)

(关于Marko 的评论)

As far as positioning/styling the <legend>, I hide the <legend>(still put one in there just to be semantic), and position/style an <h2>instead. I find this setup gives me nice styling options for my fieldsets.

至于定位/样式<legend>,我隐藏了<legend>(仍然把一个放在那里只是为了语义),而定位/样式是一个<h2>。我发现这个设置为我的字段集提供了很好的样式选项。

fieldset {
    border: 2px solid gray;
    padding: 1em;
    float: left;
    font-family: Arial;
}
legend {
    display: none;
}
h2 {
    border-bottom: 2px solid gray;
    margin: 1em 0;
}
p {
    margin: 1em 0;
}
<fieldset>
    <legend>Enter Name</legend>
    <h2>Enter Name</h2>
    <p>
        <label for="name">Name:</label>
        <br />
        <input type="text" name="firstname" id="name"/>
    </p>
    <p>
        <input type="submit" value="Submit"/>
    </p>
</fieldset>

回答by Den

Here is a quick easy effective way to style it..

这是一种快速简单有效的方式来设计它。

assign a class or id to the fieldset element then style it in css.

为 fieldset 元素分配一个类或 id,然后在 css 中设置它的样式。

<fieldset class="fieldset"> 

or

或者

<fieldset id="fieldset">
css.fieldset {
border: none;
}   

or

或者

fieldset {
border: none;
}