DEV Community

Cover image for Html 5 Basic Tags Example
Speedwares for Devwares

Posted on • Originally published at devwares.com on

Html 5 Basic Tags Example

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.

AD-BANNER

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:

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

Enter fullscreen mode Exit fullscreen mode

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:

<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>

Enter fullscreen mode Exit fullscreen mode

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:

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

Enter fullscreen mode Exit fullscreen mode

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:

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

Enter fullscreen mode Exit fullscreen mode

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:

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

Enter fullscreen mode Exit fullscreen mode

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:

<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>

Enter fullscreen mode Exit fullscreen mode

How it will appear:

firstName LastName age
tommay Okon 24
Jenny kwon 22

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:

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

Enter fullscreen mode Exit fullscreen mode

How it will appear:

  • mango
  • orange
  • apple

HTML Button

the html button is defined with the <button> tag

HTML CODE:

<button>Click me</button>

Enter fullscreen mode Exit fullscreen mode

How it will appear:

Contrast Bootstrap UI Kit

Create Stunning Websites and Web Apps

Building different custom components in react for your web apps or websites can get very stressful. Thats why we decided to build contrast. We have put together a UI kit with over 10000+ components, 5 admin dashboards and 23 additional different pages template for building almost any type of web app or webpage into a single product called Contrast Pro. Try contrast pro!

Contrast Design Boostrap

Contrast React Bootstrap PRO is a Multipurpose pro template, UI kit to build your next landing, admin, SAAS, prelaunch, etc project with a clean, well documented, well crafted template and UI components. Learn more about Contrast Pro

Discussion (0)