I want to create a box like this with title:
Can any one please let me know if there is a default CSS tag to do this? Or do I need to create my custom style?
The HTML <fieldset> element is used to group several controls as well as labels ( <label> ) within a web form. The HTML Label Element ( <label> ) represents a caption for an item in a user interface. As mentioned before, the fieldset and legend elements are used when creating forms.
The CSS box model is essentially a box that wraps around every HTML element. It consists of: margins, borders, padding, and the actual content.
border-box tells the browser to account for any border and padding in the values you specify for an element's width and height. If you set an element's width to 100 pixels, that 100 pixels will include any border or padding you added, and the content box will shrink to absorb that extra width.
I believe you are looking for the fieldset
HTML tag, which you can then style with CSS. E.g.,
<fieldset style="border: 1px black solid"> <legend style="border: 1px black solid;margin-left: 1em; padding: 0.2em 0.8em ">title</legend> Text within the box <br /> Etc </fieldset>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With