Open In App

Why is HTML used in Web Pages ?

Web pages are built using the HyperText Markup Language or HTML. It is a markup language that defines a webpage's content and structure using tags. These tags provide instructions to web browsers on how to show links, photos, videos, text, and other content. Consider HTML as a house's plan, detailing the rooms, doors, windows, and general design.

Working of HTML

The HTML document is typically structured as follows:

HTML document format

<!DOCTYPE html>
<html>
<!-- Content -->
</html>
<head>
<title>Example Page</title>
<!-- Other meta-information -->
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<!-- Other content -->
</body>

HTML Rendering Process

Viewing the HTML Code

There are two ways to see the HTML code of a webpage:

How to Use HTML to Create a Web Page

HTML is mainly used to structure our web page with the help of the elements and tags. It can be further used with CSS and JavaScript to enhance the attractiveness and interactivity of the web page.

Example: The below code example creates a simple web page with the help of CSS and HTML.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, 
                                   initial-scale=1.0">
    <title>
        My Simple Webpage
    </title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <h1>
        Welcome to My Page!
    </h1>
    <p>
        This is some content on my webpage.
    </p>
    <img alt="My Image" src=
"https://media.geeksforgeeks.org/wp-content/uploads/20240324185837/GFG-logo.jpg">

</body>

</html>
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
}

h1 {

    text-align: center;
    color: #333;
}

p {

    text-align: center;
    line-height: 1.5;
}

img {
    width: 200px;
    display: block;
    margin: 0 auto;
}

ul {
    list-style: none;
    padding: 0;
}

li {
    margin: 10px 0;
}

Output:

web-page

Output

Some Commonly Used HTML Tags

The below list contains some most commonly used HTML tags on every web page:

Advantages of Using HTML in a Webpage

Latest Version of HTML (HTML5)

HTML5, launched in 2014, is the current standard for web development. It offers significant improvements over its predecessors, enhancing the capabilities and functionality of websites and applications. This version has become widely adopted due to its modern features and improved performance.

Features of HTML5

Advantages of HTML5 over HTML

Article Tags :