Div in HTML

Div in HTML is the container to that defines a section. Div container can contain many elements grouped together. This is done to apply a particular style to the section.

You can put the form in a separate container by wrapping it around div element.

Similarly the paragraphs, navigation bar etc are different containers that can be wrapped around a div.

<div id="form">
  <form action="/submit_data.php">
    <input type="radio" id="male" name="gender" value="male">
    <label for="male">Male</label><br>
    <input type="radio" id="female" name="gender" value="female">
    <label for="female">Female</label><br>
    <input type="submit" value="Submit">
  </form>
</div>

Now at the time of styling which will be done using CSS, we can style the div and the style will be applicable to the container.

Leave a Reply

Your email address will not be published. Required fields are marked *