Introduction to HTML The image tag, anchor tag and the button tag The division tag Ordered and Unordered Lists in HTML Tables in HTML HTML Forms

The division tag

The division tag has no logical significance. It is used to group together various tags so that common styles or script can be applied to them. It always starts with a new line. So,it is typically used to group similar pieces of information in a HTML document. For example tags such as <a> do not take up the full width and takeup whatever space is available without starting with a new line. We can nest these tags within div tags to make them start with a new line.

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <div>
            <a href="">Check out this link!</a>
        </div>
        <div>
            <a href="">Check out this link!</a>
        </div>
        <div>
            <a href="">Check out this link!</a>
        </div>
        <div>
            <a href="">Check out this link!</a>
        </div>
        <div>
            <a href="">Check out this link!</a>
        </div>
        <div>
            <a href="">Check out this link!</a>
        </div>
    </body>
    </html>
                

Before div

After div

However,tags like <h1> and <p> always start with a new line i.e their display is block. The <a> tag has a display inline.