An HTML document consists of elements enclosed within tags. Here’s a simple example of a basic HTML document structure:
Key Components of HTML
Doctype Declaration (
<!DOCTYPE html>
):- Specifies the document type and version of HTML (HTML5 in this case).
HTML Element (
<html>...</html>
):- The root element of the HTML document.
Head Element (
<head>...</head>
):- Contains meta-information about the document such as the title, character encoding, and links to stylesheets.
Body Element (
<body>...</body>
):- Contains the content of the web page, including text, images, and other media.
Header (
<header>...</header>
):- Typically contains introductory content or navigational links.
Navigation (
<nav>...</nav>
):- Contains navigation links.
Main (
<main>...</main>
):- Represents the dominant content of the
<body>
.
- Represents the dominant content of the
Section (
<section>...</section>
):- Defines sections in a document.
Footer (
<footer>...</footer>
):- Contains footer content, typically including contact information, copyright, etc.
Common HTML Tags
- Headings:
<h1>
,<h2>
,<h3>
, etc. - Paragraph:
<p>
- Links:
<a href="URL">Link Text</a>
- Images:
<img src="imageURL" alt="description">
- Lists:
- Ordered List:
<ol> <li>Item</li> </ol>
- Unordered List:
<ul> <li>Item</li> </ul>
Attributes
Attributes provide additional information about HTML elements. They are specified within the opening tag and are written as name-value pairs.
href
: Specifies the URL of a link (used with<a>
).src
: Specifies the path to an image file (used with<img>
).alt
: Provides alternative text for an image if it cannot be displayed
No comments:
Post a Comment