Using the display property, HTML elements become interchangeable from a styling perspective. This doesn’t seem to be the case for fieldset and legend, however.
Is it possible to style other HTML elements to look like fieldset and legend?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The previous answer is incorrect, if you want to see why try this:
AFAIK there is no way to have that border-disruption effect that the
legendelement causes on thefieldset‘s border. I don’t believe that is possible with CSS alone, it’s just something that is part of the way thefieldsettag is rendered.Clarification: I don’t know of any way to position a block or inline element such that it straddles the visible border of its containing block element, and then causes the container element’s border to be broken behind its box. That’s what a
<legend>does to the border on its containing<fieldset>element.