HTML Basic

Basic HTML Examples

πŸ“˜ Introduction: Basic HTML Examples

This page will walk you through some basic examples in HTML. Don't worry if some of the tags look new β€” you'll get familiar with them as you practice.

πŸ’‘ Important: Every HTML file must begin with a declaration and include standard HTML structure like <html>, <head>, and <body>.

πŸ—‚οΈ HTML Page Structure

All web pages are built on a basic structure:

<!DOCTYPE html>
<html>
  <body>

    <h1>Welcome Message</h1>
    <p>This is a sample paragraph.</p>

  </body>
</html>
  

πŸ“Œ What Does <!DOCTYPE> Do?

The <!DOCTYPE html> line tells the browser to use HTML5. It only appears once β€” right at the top of the page.

βœ… It is not case-sensitive, but writing it in lowercase is the standard.

πŸ”€ Headings in HTML

HTML provides six heading levels, from most important (<h1>) to least important (<h6>):

<h1>Main Title</h1>
<h2>Subheading</h2>
<h3>Section Heading</h3>
  

πŸ“„ Paragraphs

Paragraphs are written using the <p> tag:

<p>This is one paragraph.</p>
<p>This is another paragraph.</p>
  

πŸ”— Adding Links

To add a link, use the <a> tag with the href attribute:

<a href="https://example.com">Visit Example</a>
  
πŸ“Œ Tip: Attributes like href, src, and alt give extra info about HTML elements. You'll learn more about them soon.

πŸ–ΌοΈ Adding Images

To embed an image, use the <img> tag along with attributes:

<img src="photo.jpg" alt="Description" width="300" height="200">
  

πŸ” View HTML Source

If you're curious about how a webpage works behind the scenes:

  • View Source: Right-click on any page and select "View Page Source" or press Ctrl + U.
  • Inspect Elements: Right-click an element and choose "Inspect" to see its HTML and styling.
πŸ‘¨β€πŸ’» This is a great way to explore how websites are built β€” and even test your own edits in real-time!

The Coding Journey provides high-quality, beginner-friendly, and advanced web development tutorials. Learn React, Next.js, JavaScript, Tailwind CSS, and more with hands-on projects. Build faster, code smarter, and level up your skills! πŸš€

Β© 2025 All Rights Reserved | The coding journey