postImage

Html 5 Basic Tags Example

blogImage

By Emmanuel Chinonso

Web Developer

Last updated: 5 May 2024

HTML Basic Tags

In this chapter, we are going to look at some of the examples in html. We are going to go through all the tags that will be used one by one so that you can follow.

Contrast Bootstrap UI Kit

HTML BASIC EXAMPLE

HTML DOCUMENT

All Html document must always start with a document type declaration <!DOCTYPE html>. The HTML document itself must begin with <html> and end with the </html> closing tags. This is to indicate that it is an HTML document. The visible part of the HTML document is between <body> and </body>.

HTML CODE:

html
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>

The <!DOCTYPE> Declaration The <!DOCTYPE> declaration stands for the document type, and helps browsers to display web pages correctly. Its features include that it must always appear once at the top of the page (before ant HTML tags). It is not case sensitive and is written as <!DOCTYPE html> in HTML5.

HTML Headings

The HTML heading is defined from <h1> till <h6> The <h1> is usually the biggest heading and is the most important heading. The <h6> is usually the smallest heading and is the least important heading.

HTML CODE:

html
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
<h6>This is a heading</h6>

How it will appear:

This is a heading

This is a heading

This is a heading

This is a heading

This is a heading
This is a heading

HTML Paragraphs

HTML paragraphs are defined with <p> tag

HTML CODE:

html
<p>This is a paragraph</p>
<p>This is another paragraph</p>

How it will appear:

This is a paragraph

This is another paragraph


HTML LINK

The HTML link is usually defined with <a> tag:

HTML CODE:

html
<a href="https://www.google.com">
This is a link
</a>

How it will appear:

This is a link

The links destination is specified in the href attribute. Attribute will be looked at in a later lesson. It provides additional information about that HTML element.

HTML Images

HTML images is defined with the <img> tag. The attribute has the source file(src), alternative text (alt), width, and height.

HTML CODE:

html
<img src="https://cdn.pixabay.com/photo/2017/11/03/18/26/sea-2915187_960_720.jpg"
alt="example image" width="164" height="144" />

How it will appear:

example image

How to view HTML source?

If you have a web page. You will probably wonder how they do that. At the web page right-click and select “View Page Source” (in Chrome). This will open a window containing the HTML source code of the page. Inspect an HTML Element Right-click on the 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 CSS) don’t worry we are going to learn of CSS in another lesson. You will be able to edit the codes (HTML and CSS).

HTML Tables

The <table> tag defines an HTML table. Each table row is defined with <tr> tag. Each table header is defined with <th> tag. Each table data/cell is defined with a <td> tag. These tags have default which include having the text in <th> element in bold and centered. Equally, the text in <td> element is regular and left-aligned.

HTML CODE:

html
<table style = width: 100%”>
<tr>
<th>firstName</th>
<th>LastName</th>
<th>age</th>
</tr>
<tr>
<td>tommay</td>
<td>Okon</td>
<td>24</td>
</tr>
<tr>
<td>Jenny</td>
<td>kwon</td>
<td>22</td>
</tr>
</table>

How it will appear:

firstNameLastNameage
tommayOkon24
Jennykwon22

HTML List

The html list is usually donated with the <ul> (unordered/bullet list) or the <ol> (ordered/numbered list) tag, followed by the <li> tags (list items)

HTML CODE:

html
<ul>
<li>mango</li>
<li>orange</li>
<li>apple</li>
</ul>

How it will appear:

  • mango
  • orange
  • apple

HTML Button

the html button is defined with the <button> tag

HTML CODE:

html
<button>Click me</button>

How it will appear:

Contrast Bootstrap UI Kit

Build modern projects using Bootstrap 5 and Contrast

Trying to create components and pages for a web app or website from scratch while maintaining a modern User interface can be very tedious. This is why we created Contrast, to help drastically reduce the amount of time we spend doing that. so we can focus on building some other aspects of the project.

Contrast Bootstrap PRO consists of a Premium UI Kit Library featuring over 10000+ component variants. Which even comes bundled together with its own admin template comprising of 5 admin dashboards and 23+ additional admin and multipurpose pages for building almost any type of website or web app.
See a demo and learn more about Contrast Bootstrap Pro by clicking here.

Related Posts