Activity 3.24
HTML Basics Tutorial
What is HTML?
HTML (HyperText Markup Language) is the standard language used to create web pages. It uses tags to structure content and tell the browser how to display text, images, links, and other elements.
Basic HTML Structure
Every HTML document follows this basic structure:
Key Components:
<!DOCTYPE html>
- Declares this as an HTML5 document<html>
- Root element that wraps all content<head>
- Contains metadata about the document<title>
- Sets the page title (appears in browser tab)<body>
- Contains all visible content
HTML Tags and Elements
HTML uses tags to mark up content. Tags are enclosed in angle brackets < >
.
Tag Structure:
Opening tag:
<tagname>
Closing tag:
</tagname>
Self-closing tag:
<tagname />
Example:
Essential HTML Elements
Headings
HTML provides six levels of headings:
Paragraphs
Text Formatting
Links
Images
Lists
Unordered Lists (Bullet Points)
Ordered Lists (Numbered)
Tables
<table>
- Creates the table<tr>
- Table row<th>
- Table header cell<td>
- Table data cell
Forms
Common Input Types:
text
- Single line textemail
- Email addresspassword
- Password fieldnumber
- Numeric inputcheckbox
- Checkboxradio
- Radio buttonsubmit
- Submit button
Semantic HTML Elements
These elements provide meaning to your content:
Attributes
HTML elements can have attributes that provide additional information:
Common Attributes:
id
- Unique identifier for an elementclass
- Groups elements for stylingsrc
- Source for images, videos, etc.href
- URL for linksalt
- Alternative text for imagestitle
- Tooltip texttarget
- How to open links
Comments
Add comments to your HTML code (not visible on the page):
Complete Example
Best Practices
Always close your tags - Every opening tag should have a corresponding closing tag
Use semantic elements - Choose elements based on meaning, not appearance
Include alt text for images - Important for accessibility
Indent your code - Makes it easier to read and debug
Use lowercase for tags and attributes - Standard convention
Validate your HTML - Use online validators to check for errors
Next Steps
Now that you understand HTML basics, you can:
Practice creating simple web pages
Learn CSS to style your HTML
Explore JavaScript to add interactivity
Study responsive design principles
Learn about web accessibility
Remember: HTML provides the structure and content of web pages, while CSS handles the visual styling and JavaScript adds interactive functionality.
Last updated