-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
HTML5 Basics
HTML Introduction
HTML Editors
HTML Basic
HTML Elements
HTML Attributes
HTML Headings
HTML Paragraphs
HTML Styles
HTML Formatting
HTML Quotations
HTML Comments
HTML Styling and Design
HTML Links and Media
HTML Layout and Structure
HTML Tables
HTML Lists
HTML Block & Inline
HTML Div
HTML Classes
HTML Id
HTML Head
HTML Layout
HTML Responsive
HTML Computercode
HTML Semantics
HTML Forms
HTML Forms
HTML Form Attributes
HTML Form Elements
HTML Input Types
HTML Input Attributes
Input Form Attributes
HTML Graphics
HTML APIs
HTML Advanced Topics
An HTML element is everything from the start tag to the end tag, including its content.
<tagname>Content goes here</tagname>
Example:
<p>This is a paragraph.</p>
Part | Description |
---|---|
Start Tag | <p> – Opens the element |
Content | This is a paragraph. |
End Tag | </p> – Closes the element |
Full Element | <p>This is a paragraph.</p> |
You can place one element inside another — this is called nesting.
<p>This is a <strong>bold</strong> word.</p>
📌 Always close nested tags in the reverse order they were opened.
Some elements do not have content or closing tags.
Examples:
<br> <!-- Line break -->
<hr> <!-- Horizontal rule -->
<img src="pic.jpg" alt="Photo"> <!-- Image -->
Type | Description | Examples |
---|---|---|
Block | Starts on a new line, takes full width | <div> , <p> , <h1> |
Inline | Stays in line with text, takes only necessary space | <span> , <a> , <img> |
Example:
<p>This is <span>inline</span> text.</p>
<!DOCTYPE html>
<html>
<head>
<title>HTML Elements Example</title>
</head>
<body>
<h1>Welcome!</h1>
<p>This is a paragraph with <a href="#">a link</a>.</p>
<hr>
<img src="example.jpg" alt="Example Image">
</body>
</html>
HTML elements can have attributes (like href
, src
, alt
, etc.)
Be careful with proper nesting
Indentation improves readability
Q1. Create a paragraph element using <p>
with any text.
Q2. Write a heading using <h2>
with the text "My Page".
Q3. Create a nested element with <strong>
inside a <p>
.
Q4. Insert a horizontal line using the <hr>
tag.
Q5. Add a line break using the <br>
tag between two sentences.
Q6. Create an anchor tag <a>
with link text "Click here".
Q7. Add an image element <img>
with a sample src
and alt
.
Q8. Identify 2 block elements and add them to an HTML file.
Q9. Write an inline element example using the <span>
tag.
Q10. Create a full HTML page with at least 5 different elements.
HTML5 Basics
HTML Introduction
HTML Editors
HTML Basic
HTML Elements
HTML Attributes
HTML Headings
HTML Paragraphs
HTML Styles
HTML Formatting
HTML Quotations
HTML Comments
HTML Styling and Design
HTML Links and Media
HTML Layout and Structure
HTML Tables
HTML Lists
HTML Block & Inline
HTML Div
HTML Classes
HTML Id
HTML Head
HTML Layout
HTML Responsive
HTML Computercode
HTML Semantics
HTML Forms
HTML Forms
HTML Form Attributes
HTML Form Elements
HTML Input Types
HTML Input Attributes
Input Form Attributes
HTML Graphics
HTML APIs
HTML Advanced Topics