HTML
Hypertext Markup Language
It is the standard markup language for creating web pages (markup languages are used to
structure, format and present content)
It describes the structure of web pages
It has elements that tell the browser how to display content
HTML ELEMENTS
1. <!DOCTYPE html>: Declares the document as HTML5.
2. <html>: The root element wrapping all HTML content.
3. <head>: Contains meta information about the page (not visible on the page itself).
4. <title>: Sets the title of the page (shown in the browser tab or title bar).
5. <body>: Contains all visible content like text, images, links, etc.
6. <h1>: Defines a large heading. [h2-h6]
7. <p>: Defines a paragraph of text.
These are the basic building blocks of an HTML document!
HTML Elements are defined by a start tag, some contents, and an end tag
<tag> content </tag>
HTML elements entail everything from the start tag to the end tag.
<h1> - Start tag
The Learning Hub - element content
</h1> - End tag
Some elements have no content and no end tag. These elements are called Empty elements
Example: <br> [Break]
Web browsers are used to read HTML documents and also determining how to display the
document.
To learn HTML, you will need a text editor. i.e Notepad, Notepad++, Sublime text
Use Notepad ++ or Sublime text to create your first basic webpage.
Make sure to save your file with a ‘.html’ extension to make it accessible via your browser.
HTML BASICS
HTML documents must start with a document type declaration: <!DOCTYPE html> [This
helps browsers to display web pages correctly]
HTML documents start and end with the <html></html> tags.
As shown on the screenshot above, the <body></body> is the visible part of a HTML
document when viewed on a browser.
Headings [<h1></h1>]
<h1> is the most important and largest heading.
<h6> is the least important and smallest heading.
Paragraphs [<p></p>]
Paragraphs are defined with the <p> tag
Links [<a>] | <a href=" "></a>
<a href=”www.thelearninghub.co.ke”> School Website Link </a>
Link’s destination is always specified in the href attribute.
[Attributes are used to provide additional info about HTML elements]
Images <img>
Image tags are used to embed images in a HTML document.
Image tags have two required attributes: src (source) & alt (alternate text for the image, if
image fails to load)
Width and Height attributes can also be added to guide the browser on how to display the
images.
<img src=”image.jpg” alt=”alt-text” width=”100” height= “70”>
HTML ELEMENTS
HTML elements include everything from the start tag <tag> to the end tag </tag>
<h1>Heading </h1>
<p> Paragraph</p>
<br> [break]
<hr> [line]
Nested Elements
HTML elements can be nested, implying that elements can contain other elements.
All HTML documents consist of nested HTML elements.
the <p></p> | <h1></h1> elements are nested in the <body></body> element.
All elements are nested inside the <html></html> element.