Search code examples
htmlcssradio-buttonstylesborder

Border around radio button


Here is what I want to achieve:

here is the link to the border

Can anyone help me replicate the border used there? I wrote the code for the radio buttons, they work but I just cant figure out how to do that border, how does the border stop before and after the word?

any help would be so appreciated!


Solution

  • You can wrap your radio buttons with a <fieldset></fieldset> tag and your text with a <legend></legend> tag.

    Example

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