HTML Introduction

HTML (HyperText Markup Language) is the standard language used to create and structure web pages. It uses a system of tags to define the elements on a webpage, such as headings, paragraphs, links, images, and more. HTML forms the backbone of a webpage's structure, while CSS (Cascading Style Sheets) and JavaScript are used for styling and interactivity.

Key Components of HTML:

  1. Elements: The fundamental building blocks of HTML, represented by tags like <html>, <head>, <body>, etc.
  2. Tags: Tags define elements. They usually come in pairs, with an opening tag and a closing tag, like <p> (opening) and </p> (closing).
  3. Attributes: Tags can have attributes that provide additional information. For example, <img src="image.jpg" alt="An image"> includes the src (source) and alt (alternative text) attributes.
  4. Document Structure:
    • <!DOCTYPE html>: Declares the document type and version of HTML.
    • <html>: The root element of an HTML document.
    • <head>: Contains meta-information, such as the title and links to external files.
    • <body>: Contains the content of the webpage that is visible to users.

Example of Basic HTML Structure:

html
<!DOCTYPE html>
<html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My First Web Page</title> </head> <body> <h1>Welcome to My Website</h1> <p>This is a paragraph of text on my webpage.</p> <a href="https://www.example.com">Click here to visit another page</a> </body> </html>

Common HTML Tags:

  • Headings: <h1> to <h6> define headings, with <h1> being the largest and most important.
  • Paragraphs: <p> is used to define a paragraph of text.
  • Links: <a> defines hyperlinks. Example: <a href="https://www.example.com">Click Here</a>.
  • Images: <img> embeds an image on the page, with attributes like src for the image source and alt for alternative text.
  • Lists:
    • Unordered lists: <ul> for a list with bullet points.
    • Ordered lists: <ol> for a numbered list.
    • List items: <li> are used to define individual list items.

Conclusion:

HTML is essential for building websites. By combining it with CSS for styling and JavaScript for interactivity, you can create dynamic and visually appealing web pages.

Comments

Popular posts from this blog

HTML Elements

HTML Basic