HTML Div

The <div> tag defines as a division or a section in an HTML document. The <div>tag is used as a container for HTML elements. It has no effect on the content or layout until styled in some way using CSS.


For Example:

HTML:

<!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">
    <link rel="stylesheet" href="styles.css">
    <title>Document</title>
</head>
<body>
    <!-- we add class to define div -->
    <div class="container">
        <h3>Hello Friends</h3>
        <p>My name is junaid and i read in class 10</p>
        <h4>I'm going to wash my hands.</h4>
    </div>
</body>
</html>

CSS:

.container {
    background-color: goldenrod;
}

If you want to check more about divs, the link is given below:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div

Comments

Popular Posts