Absolute URL
Contains the complete address.
<a href="https://codebhavya.com/">
CodeBhavya
</a>
Learn how HTML communicates written content, creates navigation, displays images, embeds audio and video, and connects external content to a web page.
After completing this level, you should be able to create meaningful text content, navigation links and multimedia content using HTML.
HTML is not only about creating boxes on a screen. One of its most important jobs is to communicate the structure and meaning of written content.
A browser needs to understand whether a piece of content is a heading, paragraph, quotation, code sample or emphasized statement.
Correct HTML structure improves readability, accessibility, maintainability and the way browsers and assistive technologies understand a page.
The <p> element represents a paragraph.
<p>HTML gives structure to web content.</p>
<p>CSS controls presentation.</p>
<p>JavaScript adds behaviour.</p>
<br>
The <br> element creates a line break
within text.
<p>
CodeBhavya<br>
From Learning to Limitless Possibilities.
</p>
<br> elements just to
create page spacing. Layout spacing should normally be
handled by CSS.
HTML provides six heading levels:
<h1>Main Heading</h1>
<h2>Major Section</h2>
<h3>Subsection</h3>
<h4>Detailed Subsection</h4>
<h5>Smaller Heading</h5>
<h6>Smallest Heading</h6>
Think of headings as the outline of your document.
| Element | Purpose | Example |
|---|---|---|
<strong> |
Strong importance | Important concept |
<em> |
Emphasis | Important word |
<mark> |
Highlighted/relevant text | Highlighted |
<small> |
Side information | Additional information |
<del> |
Deleted content | |
<ins> |
Inserted content | New price |
<sub> |
Subscript | H2O |
<sup> |
Superscript | x2 |
<p>
HTML is <strong>important</strong> for web development.
</p>
<p>
Learn <em>step by step</em>.
</p>
<p>
Water = H<sub>2</sub>O
</p>
<p>
Area = x<sup>2</sup>
</p>
<q>
<p>
The instructor said:
<q>Learn by building.</q>
</p>
<blockquote>
<blockquote>
Learning web development requires understanding
how structure, presentation and behaviour work together.
</blockquote>
<cite>
<p>
Source:
<cite>HTML Living Standard</cite>
</p>
<code> and <pre>
The <code> element represents a fragment
of computer code.
<p>
Use the <code>console.log()</code> function.
</p>
The <pre> element preserves whitespace
and line breaks.
<pre>
function hello() {
console.log("Hello");
}
</pre>
<a>
The anchor element creates hyperlinks.
<a href="https://codebhavya.com/">
Visit CodeBhavya
</a>
Contains the complete address.
<a href="https://codebhavya.com/">
CodeBhavya
</a>
Describes a location relative to the current page.
<a href="index.html">
Web Technologies
</a>
An element can have an id, and a link can use
that ID with #.
<section id="media">
<h2>Media</h2>
</section>
<a href="#media">
Jump to Media
</a>
This technique is useful for long documentation pages.
<a
href="https://example.com"
target="_blank"
rel="noopener noreferrer"
>
Open Website
</a>
target="_blank", using
rel="noopener noreferrer" is a good defensive
practice for external links.
<a href="mailto:hello@example.com">
Email Us
</a>
<a href="tel:+911234567890">
Call Us
</a>
These links allow devices to hand the action to an appropriate email or telephone application.
<img>
Images are embedded using the <img>
element.
<img
src="images/codebhavya.png"
alt="CodeBhavya learning platform"
>
img element is a void element.
It does not have a closing </img> tag.
alt
The alt attribute provides a text alternative
for an image.
<img
src="http-flow.png"
alt="Diagram showing an HTTP request from a browser to a server"
>
<img
src="decorative-line.png"
alt=""
>
<img
src="course.jpg"
alt="Web Technologies course"
width="800"
height="450"
>
Width and height can communicate the intrinsic dimensions of an image. CSS can then control its responsive display.
<figure> and <figcaption>
<figure>
<img
src="browser-flow.png"
alt="Browser request and response flow"
>
<figcaption>
Basic browser-server communication.
</figcaption>
</figure>
<audio>
HTML provides native audio support.
<audio controls>
<source
src="audio/lesson.mp3"
type="audio/mpeg"
>
Your browser does not support audio playback.
</audio>
Example audio player (a two-tone WAV sound generated for this lesson):
<video>
<video
controls
width="720"
>
<source
src="video/lesson.mp4"
type="video/mp4"
>
Your browser does not support video playback.
</video>
Example video player (a short, silent CodeBhavya HTML media demo):
<source>?
A media element can contain multiple source files. This allows the browser to choose a supported source.
<video controls>
<source
src="lesson.webm"
type="video/webm"
>
<source
src="lesson.mp4"
type="video/mp4"
>
Your browser does not support video.
</video>
type attribute tells the browser what
media format the source represents.
<iframe>
An iframe embeds another browsing context inside the page.
<iframe
src="https://example.com"
title="Example website"
width="100%"
height="400"
>
</iframe>
Images, video and embedded content should not overflow smaller screens.
img,
video,
iframe {
max-width: 100%;
}
CSS will become much more powerful for responsive layouts when we reach the CSS section of this course.
Using headings only because they look large.
Using many <br> elements for layout.
Leaving useful images without meaningful alt text.
Using a clickable image without explaining its purpose.
Opening external pages in new tabs without considering the security relationship.
Embedding media that cannot be used on mobile screens.
Write HTML on the left and see the browser-rendered result on the right.
Try these challenges without looking at the solution first.
Create an HTML page containing a title, three headings and four paragraphs.
Goal: Practice document hierarchy.
Create links for Home, C, Python, AI & ML and Web Technologies.
Use relative links for pages inside your website.
Create a page with Introduction, HTML, CSS and JavaScript sections. Add a navigation menu that jumps to each section.
Add three images:
Write appropriate alt text for each.
Create a page containing an image, audio player, video player and an iframe.
Create an HTML tutorial explaining
<a>,
<img>,
<audio> and
<video>.
Display the examples using
<pre> and
<code>.
Build a complete HTML-only CodeBhavya lesson.
Include headings, paragraphs, internal navigation, external links, images, figure captions, audio, video and a final resources section.
Build a placement preparation resource page containing links to C, DSA, Python, Java and aptitude resources.
Add relevant images and a video learning resource.
Which element represents a paragraph?
Which element creates a hyperlink?
Which attribute specifies the destination of a link?
Which attribute provides alternative text for an image?
Which element is used for audio?
Which element is used to embed video?
Which element provides a caption for a figure?
Which element embeds another browsing context?
Hover over a card to reveal the answer.
<strong> conveys strong
importance, while <b>
mainly draws attention without adding the
same semantic meaning.
It provides a text alternative that communicates the useful meaning of an image when the image cannot be perceived.
href specifies the destination
of an anchor link.
An absolute URL identifies a complete address. A relative URL describes a location relative to the current document.
They group media with an associated caption, making the relationship between the content and its explanation explicit.
Multiple source files can be supplied so the browser can choose a format it supports.
| Concept | Remember |
|---|---|
| Paragraph | <p> |
| Heading | <h1> to <h6> |
| Hyperlink | <a href="..."> |
| Internal link | href="#id" |
| Image | <img> |
| Image alternative | alt |
| Figure | <figure> |
| Figure caption | <figcaption> |
| Audio | <audio> |
| Video | <video> |
| Media source | <source> |
| Embedded browsing context | <iframe> |
Hover over each card to reveal the definition.
An HTML element used to create hyperlinks.
A complete URL containing the full destination address.
A URL interpreted relative to the current document or site location.
Text that communicates the useful meaning of an image.
A self-contained piece of media or content that can have an associated caption.
An element used to embed another browsing context inside the current page.
A specific audio or video resource supplied using the source element.
Marking content according to its meaning, such as strong importance or emphasis.
Media that can adapt to available screen space without causing unwanted overflow.
Create one complete HTML page called web-learning-resources.html.
You now understand how HTML represents text, creates navigation and embeds different types of media.
The next major step is to expand your HTML knowledge with additional document structures and controls before moving deeper into CSS.
Complete the knowledge check and practice challenges to reinforce this level.