0% found this document useful (0 votes)
29 views5 pages

What Is HTML?: Example Explained

HTML is a markup language used to define the structure and layout of web pages. HTML uses tags to mark elements like headings, paragraphs, links, images, and more. Tags like <h1> define headings, <p> defines paragraphs, <a> defines links, and <img> embeds images. CSS can be used to further control the appearance of HTML elements by modifying properties like color, font, size, and alignment.

Uploaded by

swati sharma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
29 views5 pages

What Is HTML?: Example Explained

HTML is a markup language used to define the structure and layout of web pages. HTML uses tags to mark elements like headings, paragraphs, links, images, and more. Tags like <h1> define headings, <p> defines paragraphs, <a> defines links, and <img> embeds images. CSS can be used to further control the appearance of HTML elements by modifying properties like color, font, size, and alignment.

Uploaded by

swati sharma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 5

What is HTML?

HTML is a markup language for describing web documents (web pages).

HTML stands for Hyper Text Markup Language


A markup language is a set of markup tags
HTML documents are described by HTML tags
Each HTML tag describes different document content

<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

Example Explained

The text between <html> and </html> describes an HTML document


The text between <head> and </head> provides information about the
document
The text between <title> and </title> provides a title for the document
The text between <body> and </body> describes the visible page
content
The text between <h1> and </h1> describes a heading
The text between <p> and </p> describes a paragraph

HTML Links
HTML links are defined with the <a> tag:

Example
<a href="http://www.w3schools.com">This is a link</a>

HTML Images
HTML images are defined with the <img> tag.

The source file (src), alternative text (alt), and size (width and height) are
provided as attributes:

Example
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">

The title Attribute


Here, a title attribute is added to the <p> element. The value of the title
attribute will be displayed as a tooltip when you mouse over the paragraph:

Example
<p title="I'm a tooltip">
This is a paragraph.
</p>

HTML Line Breaks


The HTML <br> element defines a line break.

Use <br> if you want a line break (a new line) without starting a new
paragraph:

Example
<p>This is<br>a paragraph<br>with line breaks.</p>

The HTML <pre> Element


The HTML <pre> element defines preformatted text.

The text inside a <pre> element is displayed in a fixed-width font (usually


Courier), and it preserves both spaces and line breaks:

Example
<pre>
My Bonnie lies over the ocean.

My Bonnie lies over the sea.


My Bonnie lies over the ocean.

Oh, bring back my Bonnie to me.


</pre>

HTML Background Color


The background-color property defines the background color for an HTML
element.

This example sets the background color for a page to powderblue:

Example
<body style="background-color:powderblue;">

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>

HTML Text Color


The color property defines the text color for an HTML element:

Example
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>

HTML Fonts
The font-family property defines the font to be used for an HTML element:

Example
<h1 style="font-family:verdana;">This is a heading</h1>
<p style="font-family:courier;">This is a paragraph.</p>

HTML Text Size


The font-size property defines the text size for an HTML element:
Example
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>

HTML Text Alignment


The text-align property defines the horizontal text alignment for an HTML
element:

Example
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>

HTML Text Formatting Elements

Tag Description

<b> Defines bold text

<em> Defines emphasized text

<i> Defines italic text

<small> Defines smaller text

<strong> Defines important text

<sub> Defines subscripted text

<sup> Defines superscripted text


<ins> Defines inserted text

<del> Defines deleted text

<mark> Defines marked/highlighted text

HTML <var> For Variables


The HTML <var> element defines a variable.

The variable could be a variable in a mathematical expression or a variable in


programming context:

Example
Einstein wrote: <var>E</var> = <var>m</var><var>c</var><sup>2</sup>.

Result:

Einstein wrote: E = mc2.

HTML Comment Tags


You can add comments to your HTML source by using the following syntax:

<!-- Write your comments here -->

You might also like