HTML data
Created By: chatGPT
To create a basic HTML document, you need to follow a specific structure. HTML is composed of elements represented by tags. The essential tags include
<html>
, <head>
, and <body>
. Below is a simple HTML structure.<!DOCTYPE html>
<html>
<head>
<title>My First HTML</title>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>This is a paragraph of text on my page.</p>
</body>
</html>
Inside the
<head>
section, you can include several important elements such as the <title>
, which specifies the title shown in the browser tab, and <meta>
tags that provide information about the document. It’s good practice to include a character encoding meta tag.<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First HTML</title>
</head>
The
<body>
section is where you'll put all of your content—text, images, links, etc. You can use various tags to format your text such as <h1>
for headings, <p>
for paragraphs, and <a>
for hyperlinks. Each of these tags plays an important role in organizing your content.<body>
<h1>Welcome to My Web Page</h1>
<p>This is a paragraph of text on my page.</p>
<a href="https://www.example.com">Visit Example</a>
</body>
You can also add images to your HTML document using the
<img>
tag. This tag requires a src
attribute that specifies the path to the image file and an alt
attribute for accessibility, providing a text description of the image.<img src="path/to/image.jpg" alt="Description of the image">
To style your HTML document, you can use CSS. It’s common to either link an external CSS file within the
<head>
section using the <link>
tag or embed CSS directly using the <style>
tag.<head>
<link rel="stylesheet" href="styles.css">
<style>
body {
background-color: #f0f0f0;
}
</style>
</head>
JavaScript can also be included to add interactivity to your web page. Similar to CSS, you can link an external JavaScript file using the
<script>
tag or include inline scripts. It’s best practice to place your <script>
tags just before the closing </body>
tag to ensure the HTML loads first.<body>
<h1>Welcome to My Web Page</h1>
<script src="script.js"></script>
</body>