What is HTML?

    HTML-Logo

    HTML, or HyperText Markup Language, is the standard markup language used to create web pages. It's one of the fundamental technologies that drive the internet as we know it today.

    Understanding HTML

    HTML is a language that tells a web browser how to display a web page's content. It structures the content by marking it up. This markup includes elements such as headings, paragraphs, links, images, and more.

    HTML is not a programming language; it's a markup language. The difference is that HTML doesn't have logic like programming languages. It doesn't perform calculations or make decisions; it simply structures content.

    HTML Documents

    Every web page you see on the internet is an HTML document. These documents are plain text files that can be created using any text editor. They have a .html or .htm file extension.

    <!DOCTYPE html>
    <html>
    <head>
        <title>Title of the document</title>
    </head>
    <body>
    The content of the document...
    </body>
    </html>
    

    HTML Elements

    An HTML element usually consists of a start tag, some content, and an end tag. For example, a paragraph in HTML might look like this:

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

    Some HTML elements don't have an end tag. These are called void elements. An example is the <img> element, which is used to embed images.

    HTML Tags

    HTML tags are used to define HTML elements. Most HTML elements have an opening tag and a closing tag. The closing tag is the same as the opening tag, but with a forward slash inserted before the tag name.

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

    HTML Attributes

    HTML elements can also have attributes. Attributes provide additional information about the element. They are always specified in the start tag and usually come in name/value pairs like name="value".

    For example, the href attribute of the <a> element (which creates a hyperlink) specifies the URL of the page the link goes to.

    <a href="https://www.example.com">This is a link.</a>

    Basic HTML Structure

    A basic HTML document has a specific structure. It starts with a <!DOCTYPE html>declaration, which tells the browser that this is an HTML5 document.

    <!DOCTYPE html>

    The HTML document itself begins with an <html> tag and ends with a </html> tag. Inside these tags, there are two main sections: the head and the body.

    <html>
    <head>
        <title>Title of the document</title>
    </head>
    <body>
    The content of the document...
    </body>
    </html>
    

    Creating a Simple HTML Page

    Here's an example of a simple HTML document:

    <!DOCTYPE html>
    <html>
    <head>
        <title>My First Web Page</title>
    </head>
    <body>
        <h1>Welcome to My First Web Page</h1>
        <p>This is a paragraph.</p>
        <a href="https://www.example.com">This is a link.</a>
    </body>
    </html>
    

    Viewing HTML Files

    You can view an HTML file using a web browser. When you open an HTML file in a web browser, the browser interprets the HTML code and displays the content of the file.

    Conclusion

    HTML is a powerful tool for structuring and presenting content on the internet. Understanding HTML is fundamental to web development and design. It's the starting point for anyone who wants to create web pages or web applications.

    In the next lesson, we'll delve deeper into HTML, exploring more tags, attributes, and the finer details of creating more complex HTML documents. Stay tuned!