user1739123
user1739123

Reputation: 93

Give Title of a Fieldset a Background Color

I can't figure out how to make the title of fieldset have a solid background color. When I try changing color in the CSS it colors the whole fieldset box.

Upvotes: 0

Views: 689

Answers (1)

YardenST
YardenST

Reputation: 5256

html

   <fieldset>
    <legend >Personalia:</legend>
    Name: <input type="text"><br>
    Email: <input type="text"><br>
    Date of birth: <input type="text">
  </fieldset>

css

fieldset legend {background:red}

working sample http://codepen.io/yardenst/pen/taBqH

Upvotes: 1

Related Questions