Slide 1
Slide 2
Slide 3

Div and Span tag in HTML5 (HTML-V34)

No Comments

<div> is an HTML element used to divide or organize parts of a web page's content into groups (sections / blocks), making the layout, styling, and scripting easier to manage.

<div> is a block-level element used to create a container that groups different elements together, such as text, images, tables, forms, or other elements.

<span> is an inline element used to group text or small elements within a line without starting a new line.

Source Code:

Copied!
<!DOCTYPE html>
<html>
<head>
    <title>Div and span Tag Example</title>
</head>
<body>

    <div id="menu" align="middle">
        <a href="#">HOME</a> |
        <a href="#">CONTACT</a> |
        <a href="#">ABOUT</a>
    </div>

    <div id="content" align="left">
        <h5>Content Articles</h5>
        <p>
            <span style="color:green">Actual content goes here.....</span>
        </p>
        <p>
            This is the example of span tag and the 
            <span style="color:red">div tag</span> along with CSS.
        </p>
    </div>

</body>
</html>

Result: 

Watch the video:


Ebook:
https://softkhpc.blogspot.com/2026/11/html-tutorial-beginners.html

back to top