The Digital Skills Gap

HTML Basics: Building Your First Web Page

Written by Mark Lassoff | Jul 3, 2024 2:03:54 AM

Creating a website can seem like a daunting task, but it all starts with understanding the basics of HTML. HTML, or Hypertext Markup Language, is the standard markup language used to create web pages. This guide will introduce you to the fundamentals of HTML and help you build your first web page from scratch.

Understanding HTML

HTML is the backbone of any web page. It structures the content on the web and allows browsers to interpret and display it correctly. HTML elements are represented by tags, and these tags are used to enclose different parts of the content to make it appear a certain way or perform a specific function.

Creating the Basic Structure

To create an HTML document, you need to start with a basic structure. Here is a simple template to get you started:

<!DOCTYPE html>
<html>
<head>
    <title>My First Web Page</title>
</head>
<body>
    <h1>Welcome to My Web Page</h1>
    <p>This is a paragraph of text on my first web page.</p>
</body>
</html>

Let's break down this structure:

<!DOCTYPE html>: This declaration defines the document type and version of HTML being used.
<html>: This tag encloses the entire HTML document.
<head>: This section contains meta-information about the HTML document, such as its title, which is displayed in the browser's title bar or tab.
<title>: This tag sets the title of the web page.
<body>: This section contains all the visible content of the web page, such as headings, paragraphs, images, and links.

 

Adding Headings and Paragraphs

Headings and paragraphs are fundamental elements in HTML. Headings are defined with the <h1> to <h6> tags, with <h1> being the highest (or most important) level and <h6> the least. Paragraphs are defined with the <p> tag.

Example:

<h1>This is a Heading</h1>
<p>This is a paragraph of text.</p>
<h2>This is a Subheading</h2>
<p>This is another paragraph of text.</p>

 

Creating Lists

HTML supports ordered (numbered) and unordered (bulleted) lists. Ordered lists are created with the <ol> tag, and unordered lists with the <ul> tag. List items are defined with the <li> tag.

Example:

<h3>Unordered List</h3>
<ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
</ul>

<h3>Ordered List</h3>
<ol>
    <li>First item</li>
    <li>Second item</li>
    <li>Third item</li>
</ol>

 

Incorporating Images and Links

Adding images and links to your web page can enhance its functionality and appeal. Images are added using the <img> tag, and links are created with the <a> tag.

Example:

<h3>Adding an Image</h3>
<img src="image.jpg" alt="Description of image">

<h3>Creating a Link</h3>
<a href="https://www.example.com">Visit Example.com</a>

 

Putting It All Together

Here's an example of a simple web page that incorporates headings, paragraphs, lists, images, and links:

<!DOCTYPE html>
<html>
<head>
    <title>My First Web Page</title>
</head>
<body>
    <h1>Welcome to My Web Page</h1>
    <p>This is a paragraph of text on my first web page.</p>
    <h2>About Me</h2>
    <p>Here is a little bit about myself.</p>
    <h3>My Interests</h3>
    <ul>
        <li>Web Development</li>
        <li>Photography</li>
        <li>Traveling</li>
    </ul>
    <h3>Favorite Websites</h3>
    <ol>
        <li><a href="https://www.example.com">Example</a></li>
        <li><a href="https://www.anotherexample.com">Another Example</a></li>
    </ol>
    <h3>My Latest Photo</h3>
    <img src="photo.jpg" alt="A beautiful scenery">
</body>
</html>

This example combines all the elements we've discussed and provides a foundation for creating more complex web pages. With these basics, you can start building and experimenting with your own HTML projects. Happy coding!