HTML

Introduction to HTML


HTML, or Hypertext Markup Language, is the standard markup language used to create and design web pages. It structures web content by using a series of elements and tags to define different parts of a document, such as headings, paragraphs, links, images, and other multimedia. HTML is essential for building the basic framework of a web page, enabling browsers to display text and media in an organized and visually coherent manner.
It was created by Tim Berners-Lee in 1991.



Visual Studio Code Installation


Visual Studio Code: - Visual Studio Code (VS Code) is a free, lightweight code editor developed by Microsoft. It supports various programming languages and offers features like debugging, version control, and extensions. VS Code is popular for its simplicity, speed, and powerful tools for coding.
Installing: -
Prefer this video to install Visual Studio Code
How to install Visual Studio Code

A Basic HTML Page

We start creating a website by creating a file named index.html, index.html is a special filename which is presented when the website is presented when the website root address is typed.

A Basic HTML Page Code Looks like this

<!DOCTYPE html> <!-- Defines the document type as HTML5 -->

 <html lang="en"> <!-- Root element of the HTML document, sets the language to English -->

    <head> <!-- Contains metadata, title, and links to styles or scripts -->

        <meta charset="UTF-8"> <!-- Defines character encoding as UTF-8 -->
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Ensures proper scaling on mobile devices -->

        <title>Your Title Here</title> <!-- Sets the title of the webpage -->

    </head>

    <body> <!-- The main content of the webpage -->

        <!-- Your content goes here -->

    </body>

    </html>
                

How a Website is Rendered

This is how a Website is rendered to a Client by a browser first client request browser for the site by writing the URL now database or server gives that page to the browser in the form of code and web browser converts the code into the website and render it.

Comments in HTML

In HTML, comments are pieces of code or text that the browser ignores. They are used to leave notes for yourself or others who read your code. Comments are placed between <!-- and --> tags. You can comment numbers of lines in VS code by just using a shortcut key Ctrl + /
Here's an example of Comments in HTML:

<!-- This is a Comment -->

Case Sensitivity

Tags and Attributes: HTML tags and attribute names are not case-sensitive. For Example, <DIV> is the same as <div>, and ID is the same as Id.

<DIV> This is a div </div>

HTML, Head and Body Tags

The <html> Tag The <html> tag is the root element of an HTML document. It encompasses all the content of the page.
Attributes:
lang: Specifies the language of the document.

The <head> Tag
The <head> tag contains meta-information about the HTML document. It includes elements that provide information about the document, links to stylesheets and scripts, and more.
Common Elements within <head>:
<title>: Sets the title of the document, which appears in the browser's title bar or tab.

The <body> Tag
The <body> tag contains the content of the HTML document that is displayed to the user. This includes text, images, links, tables, forms, and more.
Attributes:
onload: Executes a script when the document has finished loading.
bgcolor: Specifies the background color of the webpage.