HTML Basics
What is HTML?
HTML (HyperText Markup Language) is the standard markup language for creating web pages and
web applications. It describes the structure of a web page using elements represented by tags.
HTML 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>
Common HTML Tags
<html>: Root element of an HTML document.
<head>: Contains metadata and links to styles/scripts.
<body>: Contains the content of the web page.
<h1> to <h6>: Define headings.
<p>: Defines a paragraph.
<a>: Defines hyperlinks.
<img>: Embeds images.
Attributes
Attributes provide additional information about an element. They are defined in the opening tag and
usually come in name/value pairs.
Example:
<img src='image.jpg' alt='Description'>
Lists
HTML provides two types of lists:
1. Ordered List (<ol>) - Numbered items.
2. Unordered List (<ul>) - Bulleted items.
Example:
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
Tables
Tables are used to display data in rows and columns.
Example:
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
Forms
Forms are used to collect user input.
Example:
<form action='/submit'>
<label for='name'>Name:</label>
<input type='text' id='name' name='name'>
<input type='submit' value='Submit'>
</form>