How to create a group box
P粉818125805
P粉818125805 2024-03-22 00:16:13
0
1
384

I found the code for creating the group box:

<fieldset>
    <legend>Title</legend>
</fieldset>

It is said to create the following group boxes at runtime:

When I run it in Visual Studio Code, it looks like this:

The borders are barely visible and the text appears in the wrong place. Did I do something wrong?

P粉818125805
P粉818125805

reply all(1)
P粉052686710

The problem is that all browsers have different default styles. Your unusual.

I copied some user agent stylesheets from MacOS Chrome109

fieldset {
    display: block;
    margin-inline-start: 2px;
    margin-inline-end: 2px;
    padding-block-start: 0.35em;
    padding-inline-start: 0.75em;
    padding-inline-end: 0.75em;
    padding-block-end: 0.625em;
    min-inline-size: min-content;
    border-width: 2px;
    border-style: groove;
    border-color: rgb(192, 192, 192);
    border-image: initial;
}

legend {
    display: block;
    padding-inline-start: 2px;
    padding-inline-end: 2px;
    border-width: initial;
    border-style: none;
    border-color: initial;
    border-image: initial;
}

Title
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template