HTML stands for Hypertext Markup Language, and it is the foundation of the web. The basic syntax and structure of HTML involves using various tags and attributes to structure content on a web page. Here are some examples:
- Document Type Declaration: This tag specifies the version of HTML being used in the document. It should be placed at the very beginning of an HTML document.
- HTML Tag: This tag contains all of the HTML content for the web page, including the head and body sections.
<html> <head> <title>My Web Page</title> </head> <body> <h1>Welcome to My Web Page</h1> <p>This is a paragraph of text.</p> </body> </html>
- Head Tag: This tag contains metadata about the web page, such as the title of the page, links to CSS stylesheets, and scripts.
<head> <title>My Web Page</title> <link rel="stylesheet" href="styles.css"> <script src="script.js"></script> </head>
- Body Tag: This tag contains the visible content of the web page, such as headings, paragraphs, images, and links.
<body> <h1>Welcome to My Web Page</h1> <p>This is a paragraph of text.</p> <img src="image.jpg" alt="A picture of a sunset"> <a href="http://www.example.com">Link to example website</a> </body>
- Tag Attributes: These are additional instructions given to HTML tags to change their appearance, behavior, or function. They are added to the opening tag after the tag name.
<p class="my-class">This paragraph has a custom class applied to it.</p> <img src="image.jpg" alt="A picture of a sunset" width="500" height="300"> <a href="http://www.example.com" target="_blank">Link to example website</a>
These are just a few examples of the basic HTML syntax and structure. As you learn more about HTML, you’ll become familiar with many more tags and attributes, as well as more complex structures like forms, tables, and more.