-
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
HTML elements are building blocks of a webpage. Based on their behavior, elements are broadly categorized into:
Block-level elements
Inline elements
Block elements start on a new line and take up the full width available.
They are used to structure content into sections, paragraphs, etc.
<div>
<p>
<h1>
to <h6>
<ul>
, <ol>
, <li>
<table>
<form>
<section>
, <article>
, <header>
, <footer>
<p>This is a paragraph.</p>
<div>This is a block-level element.</div>
Inline elements do not start on a new line. They take up only as much width as necessary and are usually used to style small parts of text.
<span>
<a>
<strong>
<em>
<img>
<label>
<input>
<p>This is <strong>bold</strong> and <em>italic</em> text.</p>
Feature | Block Element | Inline Element |
---|---|---|
Line Break | Starts on a new line | Does not break line |
Width | Full width (by default) | Only needed width |
Use Case | Layout and structure | Formatting content |
You can use inline elements inside block elements, but not always vice versa.
✅ Allowed:
<p>This is <span>inline text</span> inside a paragraph.</p>
🚫 Not Allowed:
<span><div>This is invalid HTML</div></span>
Q1. Create a <div>
containing a paragraph and a heading.
Q2. Use an <h2>
tag inside a <section>
block.
Q3. Add a <span>
to highlight a word inside a sentence.
Q4. Add a link (<a>
) inside a paragraph.
Q5. Create a form with input fields (<input>
) and labels (<label>
).
Q6. Place multiple inline elements inside a block-level <div>
.
Q7. Try placing a block element inside an inline element (and explain the result).
Q8. Use both <strong>
and <em>
to style a phrase.
Q9. Create a list of items inside a <section>
block.
Q10. Use CSS to make a block element behave like inline (display: inline;
).
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