SlideShare a Scribd company logo
HTML
HTML
Hyper Text Markup Language
What is HTML?
‱ HTML stands for Hyper Text Markup Language
‱ HTML is the standard markup language for creating
Web pages
‱ HTML describes the structure of a Web page
‱ HTML consists of a series of elements
‱ HTML elements tell the browser how to display the
content
‱ HTML elements label pieces of content such as "this is a
heading", "this is a paragraph", "this is a link", etc.
HTML Documents
All HTML documents must start with a document type declaration:
<!DOCTYPE html>.
The HTML document itself begins with <html> and ends with </html>.
The visible part of the HTML document is between <body> and
</body>.
HTML Elements:
‱ The HTML element is everything from the start tag to
the end tag:
‱ <tagname>Content goes here...</tagname>
HTML is Not Case Sensitive
‱ HTML tags are not case sensitive:
<P> means the same as <p>.
Example:
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Output:
My First Heading
My first paragraph.
‱ My First Heading
‱ My first paragraph.
The <!DOCTYPE> Declaration
The <!DOCTYPE> declaration represents the document type, and helps
browsers to display web pages correctly.
It must only appear once, at the top of the page (before any HTML tags).
The <!DOCTYPE> declaration is not case sensitive.
The <!DOCTYPE> declaration for HTML5 is:
<!DOCTYPE html>
HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading.
<h6> defines the least important heading:
Example:
<!DOCTYPE html>
<html>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body>
</html>
OUTPUT:
This is heading 1
This is heading 2
This is heading 3
This is heading 4
This is heading 5
This is heading 6
HTML Paragraphs
HTML paragraphs are defined with the <p> tag:
<!DOCTYPE html>
<html>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
Output:
This is a paragraph.
This is another paragraph.
<pre>
‱ <pre> tag defines preformatted text.
‱ Text in a <pre> element is displayed in a fixed-width font, and the text
preserves both spaces and line breaks. The text will be displayed
exactly as written in the HTML source code.
Program:
<html>
<body>
<h1>The pre element</h1>
<pre>
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks
</pre>
</body>
</html>
Output:
The pre element
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks
HTML Links
HTML links are defined with the <a> tag:
<a href="https://www.annauniversity.com">
This is a link
</a>
WRAP BUTTON INSIDE LINK
<a href="https://code-boxx.com">
<button>Go to Previous</button>
</a>
‱ The link's destination is specified in the href attribute.
‱ Attributes are used to provide additional information about HTML
elements.
HTML Images
HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), width, and height are
provided as attributes:
The alt Attribute
‱ The required alt attribute for the <img> tag specifies an alternate text
for an image,
‱ if the image for some reason cannot be displayed.
‱ This can be due to slow connection, or an error in the src attribute, or
if the user uses a screen reader.
The width and height Attributes
The <img> tag should also contain the width and height attributes,
which specifies the width and height of the image (in pixels):
<img src=“master.jpg" alt=“masterfilm.com" width="104"
height="142">
Example:
<html>
<body>
<h2>HTML Images</h2>
<p>HTML images are defined with the img tag:</p>
<img src=“master.jpg" alt=“masterfilm.com" width="104" height="142">
</body>
</html>
Background Image on a HTML element
‱ To add a background image on an HTML element, use the HTML style attribute
and the CSS background-image property:
<html>
<body>
<h2>Background Image</h2>
<p>A background image for a div element:</p>
<div style="background-image: url('img_girl.jpg');">
You can specify background images<br>
</div>
<p>A background image for a p element:</p>
<p style="background-image: url('img_girl.jpg');">
You can specify background images<br>
for any visible HTML element.<br>
</p>
</body>
Background Image on a Page
‱ If we want the entire page to have a background image, we must specify the
background image on the <body> element:
<html>
<head>
<style>
body {
background-image: url('img_girl.jpg');
}
</style>
</head>
<body>
<h2>Background Image</h2>
<p>By default</p>
</body>
</html>
Background Repeat
‱ If the background image is smaller than the element, the image will repeat itself,
horizontally and vertically, until it reaches the end of the element:
<html>
<head>
<style>
body
{
background-image: url('example_img_girl.jpg’);
}
</style>
</head>
<body>
<h2>Background Repeat</h2>
<p>By default, the background image will repeat itself if it is smaller than the element where it is
specified, in this case the body element.</p>
</body>
</html>
‱ To avoid the background image from repeating itself, set the background-repeat
property to no-repeat.
<html>
<head>
<style>
body {
background-image: url('example_img_girl.jpg');
background-repeat: no-repeat;
}
</style>
</head>
<body>
<h2>Background No Repeat</h2>
<p>You cant "no-repeat".</p>
</body>
</html>
Background Cover
‱ If we want the background image to cover the entire element, we can
set the background-size property to cover.
‱ Also, to make sure the entire element is always covered, set the
background-attachment property to fixed:
‱ This way, the background image will cover the entire element, with no
stretching (the image will keep its original proportions):
<html>
<head>
<style>
body
{
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
</style>
</head>
<body>
<h2>Background Cover</h2>
<p>Set the background-size property to "cover" and the background image will cover the entire element, in this case the body element.</p>
</body>
</html>
Background Stretch
‱ If we want the background image to stretch to fit the entire element,
we can set the background-size property to 100% 100%:
‱ Try resizing the browser window, and we will see that the image will
stretch, but always cover the entire element.
<html>
<head>
<style>
body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% 100%;
}
</style>
</head>
<body>
<h2>Background Stretch</h2>
<p>Set the background-size property to "100% 100%" and the background image will be stretched to cover the entire element, in this case the
body element.</p>
</body>
</html>
The style Attribute
‱ The style attribute is used to add styles to an element, such as color,
font, size, and more.
Example:
<!DOCTYPE html>
<html>
<body>
<h2>The style Attribute</h2>
<p>The style attribute is used to add styles to an element, such as color:</p>
<p style="color:red;">This is a red paragraph.</p>
</body>
</html>
The title Attribute
The title attribute defines some extra information about an element.
The value of the title attribute will be displayed as a tooltip when you
mouse over the element:
<html>
<body>
<h2 title="I'm a header">The title Attribute</h2>
<p title="I'm a tooltip">Mouse over this paragraph, to display the title
attribute as a tooltip.</p>
</body>
</html>
The lang Attribute
‱ We should always include the lang attribute inside the <html> tag, to
declare the language of the Web page.
‱ This is meant to assist search engines and browsers.
The lang Attribute
<!DOCTYPE html>
<html lang="en">
<body>
...
</body>
</html>
‱ Country codes can also be added to the language code in the lang
attribute. So, the first two characters define the language of the
HTML page, and the last two characters define the country.
<!DOCTYPE html>
<html lang="en-US">
<body>
...
</body>
</html>
All HTML elements can have attributes
The href attribute of <a> specifies the URL of the page the link goes to
The src attribute of <img> specifies the path to the image to be displayed
The width and height attributes of <img> provide size information for images
The alt attribute of <img> provides an alternate text for an image
The style attribute is used to add styles to an element, such as color, font,
size, and more
The lang attribute of the <html> tag declares the language of the Web page
The title attribute defines some extra information about an element
HTML Text Formatting
‱ HTML contains several elements for defining text with a
special meaning.
Example
This text is bold
This text is italic
This is subscript and superscript
HTML Formatting Elements
HTML Formatting Elements
Formatting elements were designed to display special types of text:
<b> - Bold text
<strong> - Important text
<i> - Italic text
<em> - Emphasized text
<mark> - Marked text
<small> - Smaller text
<del> - Deleted text
<ins> - Inserted text
<sub> - Subscript text
<sup> - Superscript text
HTML <b> and <strong> Elements
‱ The HTML <b> element defines bold text, without any extra
importance.
<b>This text is bold</b>
‱ The HTML <strong> element defines text with strong importance. The
content inside is typically displayed in bold.
<strong>This text is important!</strong>
HTML <i> Tag
‱ The <i> tag defines a part of text in an alternate voice or mood.
‱ The content inside is typically displayed in italic.
Code:
<html>
<body>
<h1>The i element</h1>
<p><i>welcome</i> tamilnadu </p>
</body>
</html>
Output:
HTML <em> Tag
Definition and Usage
‱ The <em> tag is used to define emphasized text. The content inside is
typically displayed in italic.
Code:
<html>
<body>
<h1>The em element</h1>
<p>i <em>am</em> indian</p>
<p>We <em>are</em> indian</p>
</body>
</html>
Output:
<u> tag
‱ The content inside is typically displayed with an
underline.
Program:
<html>
<body>
<h1>The u element</h1>
<p>election commission <u>tamilnadu</u>coimbatore</p>
</body>
</html>
Output:
The u element
election commission tamilnadu coimbatore
HTML Lists
‱ HTML lists allow web developers to group a set of related items in lists.
Example
An unordered HTML list:
‱ Item
‱ Item
‱ Item
‱ Item
An ordered HTML list:
1.First item
2.Second item
3.Third item
4.Fourth item
Unordered HTML List
‱ An unordered list starts with the <ul> tag. Each list item starts with
the <li> tag.
‱ The list items will be marked with bullets (small black circles) by
default:
Example:
<html>
<body>
<h2>An unordered HTML list</h2>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
</html>
Output:
An unordered HTML list
‱ Coffee
‱ Tea
‱ Milk
Ordered HTML List
‱ An ordered list starts with the <ol> tag. Each list item starts with the
<li> tag.
‱ The list items will be marked with numbers by default:
Example:
<html>
<body>
<h2>An ordered HTML list</h2>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
Output:
An ordered HTML list
1.Coffee
2.Tea
3.Milk
HTML Description Lists
HTML also supports description lists.
A description list is a list of terms, with a description of each term.
The <dl> tag defines the description list,
the <dt> tag defines the term (name),
the <dd> tag describes each term:
<html>
<body>
<h2>A Description List</h2>
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
</body>
</html>
Output:
A Description List
Coffee
- black hot drink
Milk
- white cold drink
Define an HTML Table
‱ The <table> tag defines an HTML table.
‱ Each table row is defined with a <tr> tag. Each table header is defined
with a <th> tag. Each table data/cell is defined with a <td> tag.
‱ By default, the text in <th> elements are bold and centered.
‱ By default, the text in <td> elements are regular and left-aligned.
<html>
<body>
<table>
<tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
<tr><td>Sonoo</td><td>Jaiswal</td><td>60</td></tr>
<tr><td>James</td><td>William</td><td>80</td></tr>
<tr><td>Swati</td><td>Sironi</td><td>82</td></tr>
<tr><td>Chetna</td><td>Singh</td><td>72</td></tr>
</table>
</body>
</html>
Output:
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<h1>Programming Languages</h1>
<table>
<tr>
<th>Language</th>
<th>Release Year</th>
</tr>
<tr>
<td>Java</td>
<td>1995</td>
</tr>
<tr>
<td>Pascal</td>
<td>1970</td>
</tr>
</table>
</body>
</html>
HTML Basics
Example:
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>bala</td>
<td>kumar</td>
<td>30</td>
</tr>
<tr>
<td>muthu</td>
<td>kumar</td>
<td>28</td>
</tr>
</table>
HTML Table - Add a Caption
‱ To add a caption to a table, use the <caption> tag:
<table style="width:100%">
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
Monthly savings
Month Savings
January $100
February $50
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
</style>
</head>
<body>
<h2>Table Caption</h2>
<p>To add a caption to a table, use the caption tag.</p>
<table style="width:100%">
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
</body>
</html>
Firstname Lastname Age
Jill Smith 50
Eve Jackson 94
John Doe 80
Non-breaking Space
A commonly used entity in HTML is the non-breaking space: &nbsp;
A non-breaking space is a space that will not break into a new line.
Two words separated by a non-breaking space will stick together (not break into a new line). This is handy when breaking the words
might be disruptive.
Examples:
§ 10
10 km/h
10 PM
Another common use of the non-breaking space is to prevent browsers from truncating spaces in HTML pages.
If you write 10 spaces in your text, the browser will remove 9 of them. To add real spaces to your text, you can use the &nbsp;
character entity.

More Related Content

PPT
Basics ogHtml
DOCX
Computer application html
PPTX
HTML 5 Basics Part One
PPTX
PPTX
Chapter 6 html
 
PPTX
Elements of html powerpoint
PPTX
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
PPTX
HTML Basics 1 workshop
Basics ogHtml
Computer application html
HTML 5 Basics Part One
Chapter 6 html
 
Elements of html powerpoint
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
HTML Basics 1 workshop

What's hot (19)

PPTX
Html Workshop
PPTX
Html
PPTX
Html Basic Tags
KEY
Html intro
PPTX
Basic HTML
PDF
SEO Training in Noida- Skyinfotech.in
PPT
Introduction to HTML
PPTX
Hyper text markup Language
PPT
HTML By K.Sasidhar
PDF
Web development using html 5
PPTX
Learn html Basics
PPTX
Html coding
PPTX
Web Page Designing Using HTML
PDF
Web Design Course: CSS lecture 2
PPTX
HyperText Markup Language - HTML
PPTX
HTML Fundamentals
PPTX
Html tables
DOCX
Html example
PPT
HTML basics
Html Workshop
Html
Html Basic Tags
Html intro
Basic HTML
SEO Training in Noida- Skyinfotech.in
Introduction to HTML
Hyper text markup Language
HTML By K.Sasidhar
Web development using html 5
Learn html Basics
Html coding
Web Page Designing Using HTML
Web Design Course: CSS lecture 2
HyperText Markup Language - HTML
HTML Fundamentals
Html tables
Html example
HTML basics
Ad

Similar to HTML Basics (20)

PPTX
Html and Css Student Education hub point.pptx
PPTX
html (1) (1).pptx for all students to learn
PPTX
html.pptx class notes to prepare html completly
PPTX
htmlbcjdkkdkcjcjcjfkjccjckcjcjc_doc1.pptx
PPTX
DOCX
Html.docx
PPTX
Day 2 - Web_Development [basic HTML tags and their functionalities].pptx
DOCX
Lesson A.1 - Introduction to Web Development.docx
PPTX
EBRE TABOR UNIVERSITY Gafat Institute of Technology Department of Information...
PPTX
WEBSITE DEVELOPMENT,HTML is the standard markup language for creating Web pag...
PDF
HTML FOR BEGINNERS AND FOR PRACTICE .pdf
PPTX
html.pptx
PPTX
Chapter 2 - Introduction to HTML (Basic Structures and Syntax).pptx
PPTX
Best Option to learn start here HTML.pptx
PPTX
PDF
Html full
PPT
html
PPTX
Frontend Devlopment internship batch 2024-2.pptx
PPTX
Frontend Devlopment internship batch 2024.pptx
PPTX
Lab1_HTML.pptx
Html and Css Student Education hub point.pptx
html (1) (1).pptx for all students to learn
html.pptx class notes to prepare html completly
htmlbcjdkkdkcjcjcjfkjccjckcjcjc_doc1.pptx
Html.docx
Day 2 - Web_Development [basic HTML tags and their functionalities].pptx
Lesson A.1 - Introduction to Web Development.docx
EBRE TABOR UNIVERSITY Gafat Institute of Technology Department of Information...
WEBSITE DEVELOPMENT,HTML is the standard markup language for creating Web pag...
HTML FOR BEGINNERS AND FOR PRACTICE .pdf
html.pptx
Chapter 2 - Introduction to HTML (Basic Structures and Syntax).pptx
Best Option to learn start here HTML.pptx
Html full
html
Frontend Devlopment internship batch 2024-2.pptx
Frontend Devlopment internship batch 2024.pptx
Lab1_HTML.pptx
Ad

Recently uploaded (20)

PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
history of c programming in notes for students .pptx
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
System and Network Administration Chapter 2
PDF
System and Network Administraation Chapter 3
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
Essential Infomation Tech presentation.pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
PDF
Nekopoi APK 2025 free lastest update
PPTX
L1 - Introduction to python Backend.pptx
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Design an Analysis of Algorithms II-SECS-1021-03
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
history of c programming in notes for students .pptx
Wondershare Filmora 15 Crack With Activation Key [2025
2025 Textile ERP Trends: SAP, Odoo & Oracle
Understanding Forklifts - TECH EHS Solution
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Upgrade and Innovation Strategies for SAP ERP Customers
System and Network Administration Chapter 2
System and Network Administraation Chapter 3
Which alternative to Crystal Reports is best for small or large businesses.pdf
Odoo Companies in India – Driving Business Transformation.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
Odoo POS Development Services by CandidRoot Solutions
Essential Infomation Tech presentation.pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
Nekopoi APK 2025 free lastest update
L1 - Introduction to python Backend.pptx
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Design an Analysis of Algorithms I-SECS-1021-03
Design an Analysis of Algorithms II-SECS-1021-03

HTML Basics