Jun 12, 2024 4 minute read
HTML Intro
Table of Contents
- What is HTML?
- What is an Element?
- Basic Structure of an HTML Document
- Displaying an HTML Page
- Commonly Used HTML Tags
- Example of a Simple Webpage
- Useful Links
What is HTML?
HTML (HyperText Markup Language) is the standard language for creating web pages. It consists of a series of elements, which tell the browser how to display the content.
What is an Element?
An HTML element is defined by a start tag, some content, and an end tag:
<tagname>
Content goes here... </tagname>
The HTML element is everything from the start tag to the end tag:
<h1>
My First Heading</h1>
<p>
My first paragraph.</p>
Basic Structure of an HTML Document
An HTML document typically follows this structure:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Displaying an HTML page
To display an HTML page, you need a browser. The purpose of a web browser, like Chrome, Firefox or Safari, is to read HTML documents and to display them correctly.
A browser does not display the HTML tags, but uses them to determine how to display the document:
As you can see, an HTML page on its own is plain and unstyled.
To make the webpage visually appealing, you use CSS (Cascading Style Sheets). CSS allows you to apply styles to your HTML elements, such as colors, fonts, spacing, and layout.
Example of a Simple Webpage
<!DOCTYPE html>
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
<header>
<h1>Welcome to My Webpage</h1>
</header>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<main>
<section>
<h2>About Me</h2>
<p>Hi, I'm a web developer!</p>
<img src="myphoto.jpg" alt="My Photo">
</section>
</main>
<footer>
<p>© 2024 My First Webpage</p>
</footer>
</body>
</html>