Form without p tag inside

I saw an example from MDN

<body>
    <form>
        <p>
          <label for="taste_1">I like cherry</label>
          <input type="checkbox" id="taste_1" name="taste_cherry" value="1">
        </p>
        <p>
          <label for="taste_2">I like banana</label>
          <input type="checkbox" id="taste_2" name="taste_banana" value="1">
        </p>
    </form>
</body>

I never used p tags inside form element.

What is means if have set p tag for input and label?

Is break the form as the p make new lines.

Thanks!

Hi,

<p> ... </p> is a block element.

In this particular case it makes the combination of each label and input to start on a new line.

If you just remove the both p tags, they both will align into a single line.

2 Likes