HTML details
Created By: chatGPT
HTML (Hypertext Markup Language) is the standard language used to create and structure content on the Web. It consists of various elements, or tags, that define the structure and presentation of the content. Here’s a brief overview of some commonly used HTML elements.
<!DOCTYPE html>
<html>
<head>
<title>Sample HTML Document</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<a href='https://www.example.com'>This is a link</a>
<a href='#' onclick='alert("Hello World!")'>Click Here</a>
</body>
</html>
The to tags are used for headings, with as the highest level and as the lowest. The tag represents a paragraph, while the tag is used to create hyperlinks. Links can lead to external sites or trigger JavaScript functions.
<h1>Main Title</h1>
<h2>Subheading</h2>
<p>This is a sample paragraph describing the content.</p>
<a href='https://www.google.com'>Visit Google</a>
To stylize your HTML, you can apply CSS (Cascading Style Sheets). Styles can be included in the section to apply rules globally to your entire document or inline within elements for specific styles.
<style>
body {
background-color: #f0f0f0;
font-family: Arial, sans-serif;
}
h1 {
color: blue;
}
</style>
To include images, use the tag, ensuring to provide a source attribute (src) and an alt attribute for accessibility. Additionally, lists can be created using
<img src='image.jpg' alt='A descriptive text'>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>First Item</li>
<li>Second Item</li>
</ol>
Forms are essential for capturing user input, and are defined using the element, along with input types that allow for various data entry methods, such as text, password, email, and radio buttons.
<form action='/submit' method='post'>
<label for='name'>Name:</label>
<input type='text' id='name' name='name'><br>
<input type='submit' value='Submit'>
</form>