What is HTML?
HTML is the standard markup language used to create web pages. It provides a structured way to define the content and layout of a webpage. Each element in an HTML document is represented by a tag, which tells the browser how to display that element. Let's look at some common HTML tags and how they are used.HTML Tags and Elements
1. <html> Tag
The <html> tag is the root element of an HTML document. It contains all other elements on the page. Here's an example:
html<!DOCTYPE html><html><head><title>My First Webpage</title></head><body><h1>Welcome to My Webpage</h1><p>This is a simple example of an HTML document.</p></body></html>
2. Headings <h1> to <h6> Tags
Headings are used to define the hierarchy of content on a webpage. <h1> is the highest level and <h6> is the lowest level. Here's an example:html<h1>Main Heading</h1>
<h2>Subheading</h2>
3. Paragraph <p> Tag
The <p> tag is used to define paragraphs of text. It's a simple way to structure the content on your webpage:html<p>This is a paragraph of text.</p>
<p>Another paragraph goes here.</p>
4. Hyperlinks <a> Tag
Hyperlinks, or links, allow you to connect different web pages. The <a> tag is used to create links:
html<a href="https://www.example.com">Visit Example Website</a>
5. Images <img> Tag
Images can be displayed using the <img> tag:html<img src="image.jpg" alt="Description of the image">
Building Your First Webpage
Now, let's put these HTML elements together to create a simple webpage. Copy and paste the following code into a text editor and save it as "index.html":html<!DOCTYPE html><html><head><title>My First Webpage</title></head><body><h1>Welcome to My Webpage</h1><p>This is a simple example of an HTML document.</p><a href="https://www.example.com">Visit Example Website</a><img src="image.jpg" alt="An example image"></body></html>
Open the saved file in your web browser, and you'll see your first webpage!
No comments:
Post a Comment