#3 HTML Basic
In this tutorial, we will see some basic HTML tags with examples. Don’t worry if we use tags you have not learned about yet.
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>
.
Example
See the Pen intro to html by Arpit (@soniarpit) on CodePen.
The 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 Comment Tags
You can add comments to your HTML source by using the following syntax
<!-- Write your comments here -->
<!-- Do not display this image at the moment
<img border="0" src="pic_trulli.jpg" alt="Trulli">
-->
Notice that there is an exclamation point (!) in the start tag, but not in the end tag.
Comments are not displayed by the browser or on the website, but they can help developers your HTML source code.
HTML Headings
Any document starts with a heading. You can use different sizes for your headings.
HTML headings are defined with the <h1>
to <h6>
tags.
<h1>
defines the most important heading. <h6>
defines the least important heading:
See the Pen html headings by Arpit (@soniarpit) on CodePen.
We will also see in detail about this tag.
HTML Paragraphs
The <p>
tag offers a way to structure your text into different paragraphs.
See the Pen paragraph tag by Arpit (@soniarpit) on CodePen.
We will also see in detail about this tag.
HTML Links
HTML links are defined with the <a>
tag
See the Pen html link by Arpit (@soniarpit) on CodePen.
We will also see in detail about this tag.
How to View HTML Source?
Have you ever seen a Web page and wondered “Hey! How did they do that?”
View HTML Source Code:
Right-click on an HTML page and select “View Page Source” (in Chrome) or “View Source” (in Edge), or similar in other browsers. This will open a window containing the HTML source code of the page.
Inspect an HTML Element:
Right-click on an element (or a blank area), and choose “Inspect” or “Inspect Element” to see what elements are made up of (you will see both the HTML and the CSS). You can also edit the HTML or CSS on-the-fly in the Elements or Styles panel that opens.
Hope you like this tutorial.
Previous: #2 Editors for HTML
Next: #4 HTML Elements