Basic syntax of HTML code
The basic syntax of HTML (Hypertext Markup Language) consists of using a set of elements and tags to structure the content of a web page. Here's an overview of the basic syntax:
<!DOCTYPE html>
`<html>`
. It contains two main sections: `<head>`
and `<body>`
. The `<head>`
section contains metadata about the document (such as the title, linked stylesheets, and scripts), while the `<body>`
section contains the visible content of the web page.<html>
<head>
<!-- Metadata and references to external resources -->
</head>
<body>
<!-- Visible content of the web page -->
</body>
</html>
`<head>`
section, you can include various meta information, linked stylesheets, scripts, and more. For example:<head>
<title>My Web Page</title>
<link rel="stylesheet" href="styles.css">
<script src="script.js"></script>
</head>
`<body>`
section contains the main content of your web page, including text, images, links, and other elements. Here's an example:<body>
<h1>Welcome to My Web Page</h1>
<p>This is a paragraph of text.</p>
<img src="image.jpg" alt="An image">
<a href="https://www.example.com">Visit Example Website</a>
</body>
`<`
and `>`
). Tags usually come in pairs: an opening tag and a closing tag. The content between the opening and closing tags defines the element's content. For example:<tagname>content</tagname>
Examples include `<h1>`
for headings, `<p>`
for paragraphs, `<img>`
for images, `<a>`
for links, and more.
Remember that HTML is a language for describing the structure of web content. It provides the foundation for a web page but doesn't control its appearance or interactivity directly. CSS (Cascading Style Sheets) is used for styling, and JavaScript is used for interactivity.
Thank You