What is HTML
Overview
- What is HTML
- HTML Tags
- HTML Elements
- HTML Semantics
- Basic HTML Elements
-
Comments
- An
HTML
element is everything from the start tag to the end tag:
<tagname>Content goes here...</tagname>
Examples of some HTML elements:
<h1>My First Heading</h1>
<p>My first Paragraph</p>
Start tag | Element content | End tag |
---|---|---|
<h1> | My First Heading | </h1> |
<p> | My first paragraph. | </p> |
<b> | My first bold typographical emphasis. | </b> |
<br> | none | none |
<img> | none | none |
Web Elements
- Tags are used to delimit the start and end of a web element or html element.
- Some html elements are present regardless of an explicit declaration in the markup.
- For example, the
HEAD
element is always present, even though both start and endHEAD
tags may be missing in the markup.
- For example, the
- Contents of an element are placed after the start tag and before the end tag.
- The contents of an element are either, another element or text.
<body>This is content of the body tag!<body>
Web Element Semantics
- If an element contains another element, then the container is said be a parent of the containee.
- If an element,
A
, has a childB
, thenA
is said to be a parent ofB
- If an element,
- All elements, except
<html>
have a parent.- Each element’s parent is either another element, or
<html>
. - The
<html>
tag is the the root of an HTML document.
- Each element’s parent is either another element, or
- Most elements have children elements.
- Each element’s child is either another element or text.
<body>
This is the content of body element!
This element is a parent to the paragraph element.
The paragraph tag is a child of this element.
<p>This is the content of the paragraph element!<p>
</body>
Basic Web Elements
DOCTYPE
- The
<!DOCTYPE html>
should be the first line of all webpages. - informs browser on how to render the page in standards compliant mode.
The <html>
tag
- The
<html>
tag informs browser that this is an HTML document. - is the parent to all other HTML web-elements on a page.
- is the root of an HTML document.
The <head>
- The
<head>
element is a container for metadata (data about data). - is placed after the
<html>
tag and before the<body>
tag. - HTML metadata is data about the HTML document.
- Metadata is not displayed.
- HTML Metadata typically defines
- document title
- character set
- style
- link
- scripts
- other meta-information
<title>
- The
<title>
element sets the name of the tab of the webpage.
<body>
- The
<body>
element is where all displayable content is declared.