Welcome to our HTML Basics tutorial! In this tutorial, we'll cover the fundamental HTML elements and structure to create a basic web page.
HTML (Hypertext Markup Language) is the standard markup language used to create web pages. It's the backbone of a website, providing the structure and content that the web browser renders to the user.
Every HTML document starts with the following basic structure:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<!-- page content here -->
</body>
</html>
Let's break it down:
<!DOCTYPE html>: Declares the document type as HTML5.
<html>: The root element of the HTML document.
<head>: Contains metadata about the document, such as the title, charset, and links to external stylesheets or scripts.
<title>: Sets the title of the page, displayed in the browser's title bar and search engine results
- <body>: Contains the content of the HTML document.
Headings and paragraphs are basic HTML elements used to structure content.
- Headings: <h1>, <h2>, <h3>, etc. represent headings of different levels.
- Paragraphs: <p> represents a paragraph of text.
Example:
<h1>Main Heading</h1>
<p>This is a paragraph of text.</p>
Links and images are essential elements in HTML.
- Links: <a> represents a hyperlink to another web page or email address.
- Images: <img> represents an image file.
Example:
Lists and tables help organize content.
- Unordered Lists: <ul> represents an unordered list, with <li> representing each list item.
- Ordered Lists: <ol> represents an ordered list, with <li> representing each list item.
- Tables: <table> represents a table, with <tr> representing each table row and <td> representing each table data cell.
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<table>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</table>
Forms and inputs allow users to interact with the web page.
- Forms: <form> represents a form, with <input>, <textarea>, and <select> representing different input fields.
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name">
</form>
Congratulations! You've learned the basic HTML elements and structure. Practice building your own web page using this tutorial as a reference. In the next tutorial, we'll explore CSS basics to style your web page.