HTML Basics

What is HTML?

HTML (HyperText Markup Language) is the standard language used to structure content on the web. It tells the browser how to display text, images, and other content.

πŸ“¦ Basic Elements of HTML

HTML consists of elements, which are represented by tags. These tags typically come in pairs like <tag>content</tag>. The opening tag marks the start of an element, and the closing tag marks the end.

🧱 Example: A Basic HTML Page

Basic HTML Template

<!DOCTYPE html>
<html>
  <head>
    <title>HTML Basics</title>
  </head>
  <body>
    <h1>Welcome to HTML</h1>
    <p>This is a basic HTML page.</p>
  </body>
</html>

πŸ”‘ Common HTML Tags

TagPurpose
<h1> to <h6>Defines headings, <h1> being the largest
<p>Defines a paragraph
<a>Creates a hyperlink
<img>Displays an image
<ul>, <ol>, <li>Creates unordered/ordered lists with list items
<div>Defines a division or container

πŸ§ͺ Example: Using Common Tags

Example HTML Snippet

<h1>HTML is Easy</h1>
<p>You can build websites with simple tags.</p>
<a href="https://www.google.com">Visit Google</a>
<ul>
  <li>Learn HTML</li>
  <li>Practice</li>
  <li>Build something!</li>
</ul>

πŸ–Ό Adding Images

Use the <img> tag to add images. It is a self-closing tag and uses src and alt attributes.

Add an Image

<img src="https://via.placeholder.com/150" alt="Placeholder Image" />

Further details can be found at: https://via.placeholder.com/400x200

Note

πŸ’‘ Always use the alt attribute for accessibility and SEO.

πŸ“š Learn More

>>β€œEvery great website starts with a single <html> tag.” πŸš€