Skip to content

Latest commit

 

History

History
138 lines (94 loc) · 2.6 KB

HTML.md

File metadata and controls

138 lines (94 loc) · 2.6 KB

HTML for Beginners

Table of Contents

  1. What is HTML?
  2. Basic HTML Structure
  3. Common HTML Tags
  4. Attributes
  5. Your First Web Page
  6. Further Reading

What is HTML?

HTML is like the skeleton of a website. It gives structure to the content on the web. Imagine you're building a house; HTML would be the bricks and beams.


Basic HTML Structure

Every HTML file has a basic structure. Here it is:

<!DOCTYPE html>
<html>
  <head>
    <title>Your Web Page Title</title>
  </head>
  <body>
    <!-- Your content goes here -->
  </body>
</html>
  • <!DOCTYPE html>: Tells the browser this is an HTML5 document.
  • <html>: The root element.
  • <head>: Contains meta information and links.
  • <title>: Sets the title of your web page.
  • <body>: Holds the content of your web page.

Common HTML Tags

Here are some commonly used HTML tags:

Headings

Headings are used to define titles and subtitles. You have six levels of headings, from <h1> to <h6>.

<h1>This is a big heading</h1>

Paragraph

Paragraphs are defined using the <p> tag.

<p>This is a paragraph.</p>

Links

Links are defined using the <a> tag.

<a href="https://www.google.com">Visit Google</a>

Images

Images are placed using the <img> tag.

<img src="image.jpg" alt="A cool image">

Lists

You can create lists using <ul> (unordered) and <ol> (ordered).

<ul>
  <li>Item 1</li>
  <li>Item 2</li>
</ul>

Attributes

HTML tags can have attributes. Attributes provide additional information about an element.

  • href: Specifies the URL for a link.
  • src: Specifies the source URL of an image.
  • alt: Specifies alternative text for an image.

Example:

<a href="https://www.google.com" target="_blank">Visit Google</a>

Your First Web Page

Time to create your first web page! Open a text editor on your phone or computer and paste the following code:

<!DOCTYPE html>
<html>
  <head>
    <title>My First Web Page</title>
  </head>
  <body>
    <h1>Hello, World!</h1>
    <p>Welcome to my website.</p>
  </body>
</html>

Save it as index.html and open it with a web browser. Ta-da!


Further Reading

Ready to learn more? Check out these free resources: