HTML
HTML Introduction
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.
Tags Explained
• The <!DOCTYPE html> declaration defines that this
document is an HTML5 document
• The <html> element is the root element of an HTML page
• The <head> element contains meta information about the
HTML page
• The <title> element specifies a title for the HTML page
(which is shown in the browser's title bar or in the page's
tab)
• The <body> element defines the document's body, and is a
container for all the visible contents, such as headings,
paragraphs, images, hyperlinks, tables, lists, etc.
• The <h1> element defines a large heading
• The <p> element defines a paragraph
What is an HTML Element?
• An HTML element is defined by a start tag,
some content, and an end tag:
• <tagname> Content goes here... </tagname>
• The HTML element is everything from the
start tag to the end tag:
• <h1>My First Heading</h1>
• <p>My first paragraph.</p>
Web Browsers
• The purpose of a web browser (Chrome, Edge,
Firefox, Safari) is to read HTML documents and
display them correctly.
• A browser does not display the HTML tags, but
uses them to determine how to display the
document
HTML Page Structure
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>.
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 <marquee> Tag
• The <marquee> tag in HTML creates a
scrolling text or image effect within a
webpage. It allows content to move
horizontally or vertically across the screen,
providing a simple way to add dynamic
movement to elements.
• Although this tag is deprecated in HTML5, it is
still useful to understand its functionality for
legacy projects.
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
• <h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
HTML Paragraphs
• The HTML <p> element defines a paragraph.
• A paragraph always starts on a new line, and
browsers automatically add some white space
(a margin) before and after a paragraph.
• Example
• <p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML <hr> Tag
• The <hr> tag defines a thematic break in an
HTML page (e.g. a shift of topic).
• The <hr> element is most often displayed as a
horizontal rule that is used to separate
content (or define a change) in an HTML page.
HTML <br> Tag
• The <br> tag inserts a single line break.
• The <br> tag is useful for writing addresses or
poems.
• The <br> tag is an empty tag which means
that it has no end tag.
HTML <blockquote> Tag
• The <blockquote> tag specifies a section that is
quoted from another source.
• Browsers usually indent <blockquote>
• It gives them a different style to stand out and
look better.
• It lets you use different things like headings or
lists inside the quote.
• This helps you organize and make your quotes
more interesting for people reading your
webpage.
HTML <pre> Tag
• The <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.
HTML <b> <u> Tags
• The <b> tag specifies bold text without any
extra importance.
• The HTML <u> tag is traditionally used to
underline text. It signifies text that should
appear distinct from the surrounding content,
such as misspelled words or specific names in
various languages. However, in contemporary
web design, it is mainly used for stylistic
purposes to draw attention to certain text.
HTML <sub> Tag
• The <sub> tag defines subscript text.
• Subscript text appears half a character below
the normal line, and is sometimes rendered in
a smaller font.
• Subscript text can be used for chemical
formulas, like H2O.
HTML <sup> Tag
• The <sup> tag defines superscript text.
Superscript text appears half a character
above the normal line, and is sometimes
rendered in a smaller font.