HTML samp
Created By: chatGPT
HTML is a markup language used for creating web pages. It stands for HyperText Markup Language and is the standard for structuring content on the web. Below is a simple example of an HTML document.
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample HTML Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is a simple HTML page.</p>
<a href="https://www.example.com">Visit Example</a>
</body>
</html>
The components of this HTML document include:
- DOCTYPE declaration: Indicates the document type and version of HTML.
- element: The root element of the HTML page.
- section: Contains meta-information about the document such as the title and character set.
- : Contains the content that is displayed on the web page, such as headings, paragraphs, and links.
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample HTML Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is a simple HTML page with different elements.</p>
<a href="https://www.example.com">Visit Example</a>
</body>
</html>
Elements in HTML are represented by tags. Tags usually come in pairs: an opening tag and a closing tag. For example, <p>
is an opening tag and </p>
is a closing tag. The content is placed between these tags.
To create an unordered list, you can use the <ul>
and <li>
tags as shown below.
html
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
You can also create an ordered list using the <ol>
tag:
Attributes can be added to elements to provide additional information. For example, the href
attribute in the <a>
tag specifies the URL the link points to.
html
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
<a href="https://www.example.com">Example Link</a>