HTML, short for HyperText Markup Language, is the fundamental language used to structure and present content on the web. In this article, we'll explore the basics of HTML, including its tags and their usage. If you're new to HTML or need a refresher, you're in the right place! Let's dive in and learn how to create your first HTML document.
To begin, open a plain text editor such as Notepad or Any editor and follow these steps:
Type the following code:Â
<!DOCTYPE html>
<html>
<head>
<title>My First HTML Document</title>
</head>
<body>
<h1>Welcome to My Website!</h1>
<p>This is my first paragraph.</p>
</body>
</html>
Save the file with a .html extension, such as "index.html".
HTML tags are the building blocks of any HTML document. They provide structure and define the elements within a web page. Tags are enclosed in angle brackets and typically come in pairs. The opening tag denotes the beginning of an element, while the closing tag indicates its end. Let's analyze the code snippet mentioned above:
<!DOCTYPE html>: This declaration specifies the HTML version being used, which is HTML5.
<html>: The root element of an HTML document. All other elements are nested within it.
<head>: Contains metadata and title information for the document.
<title>: Defines the title of the web page, which appears in the browser's title bar or tab.
<body>: Encloses the visible content of the web page.
<h1>: Represents a heading element, where "My Websites" is the text content of the heading.
<p>: Defines a paragraph element, with "My Paragraph" as its content.
After saving the HTML file and opening it in a web browser, you will see the rendered output. In this case, the browser will display the heading "My Websites" and the paragraph "My Paragraph." This is the result of the HTML tags and their corresponding content.
HTML is the Markup Language used for structuring and presenting content on the web.
HTML tags are enclosed in angle brackets and come in pairs: opening and closing tags.
HTML documents begin with the <!DOCTYPE html> declaration and contain the <html>, <head>, and <body> elements.
The <title> tag defines the title of the web page, which appears in the browser.
The <h1> tag represents a heading element, while the <p> tag defines a paragraph element.
Saving an HTML file with a .html extension and opening it in a browser renders the output.
Always include the <!DOCTYPE html> declaration at the beginning of an HTML document.
Use appropriate opening and closing tags to enclose content within elements.
Experiment with different HTML tags and their attributes to enhance the structure and appearance of your web pages.
Remember that HTML provides the structure, while CSS (Cascading Style Sheets) is used for styling and layout (next tutorial).
By following these basics, you're now ready to continue your journey into HTML and build more complex and interactive web pages.Â