HTML Div tags, html css, html css tutorial for beginners, html css full course, html for beginners, html full course, css tutorial for beginners, css full course

Learn HTML 



HTML mein `div` tag ka use ek division ya section banane ke liye kiya jata hai. Yeh ek block-level element hai jo web page ke different parts ko logically group karne ke liye use hota hai. `div` tag ko styling aur layout ke liye CSS ke sath commonly use kiya jata hai.

`div` tag ka basic structure kuch is tarah hota hai:

```html
<!DOCTYPE html>
<html>
<head>
    <title>HTML Div Tag Example</title>
    <style>
        .container {
            border: 1px solid black;
            padding: 10px;
            margin: 10px;
        }
        .header {
            background-color: lightgray;
        }
        .content {
            background-color: lightblue;
        }
        .footer {
            background-color: lightgreen;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>This is the header</h1>
        </div>
        <div class="content">
            <p>This is the content section.</p>
        </div>
        <div class="footer">
            <p>This is the footer</p>
        </div>
    </div>
</body>
</html>
```

Is example mein:
- `div` tags ka use different sections ko logically group karne ke liye kiya gaya hai.
- `class` attribute ka use karke `div` elements ko CSS styles apply kiye gaye hain.
- `.container`, `.header`, `.content`, aur `.footer` classes ko use karke different styling apply ki gayi hai.

`div` tag flexible aur versatile hota hai, aur web pages ko structure aur layout karne ke liye extensively use hota hai.

Comments