Introduction to HTML
HTML, or HyperText Markup Language, is the standard language used to create and design documents on the World Wide Web. It is the backbone of web development, providing the basic structure for web pages and applications. Here’s a brief overview of its key aspects:
What is HTML?
HTML uses a system of tags to define elements on a page such as headings, paragraphs, links, images, and other multimedia content. These tags are enclosed in angle brackets, and most consist of an opening tag, content, and a closing tag.
Basic Structure of an HTML Document
An HTML document typically has the following structure:
<!DOCTYPE html>
<html>
<head>
<title>Your Page Title</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is a paragraph of text on the page.</p>
</body>
</html>
<!DOCTYPE html>: Declares the document type and version of HTML.<html>: The root element of an HTML page.<head>: Contains meta-information about the document (like title and links to stylesheets).<title>: Sets the title of the page, shown in the browser tab.<body>: Contains the content of the page that is visible to visitors.
Common HTML Elements
- Headings: Defined with
<h1>,<h2>, …,<h6>. - Paragraphs: Created with the
<p>tag. - Links: Created using the
<a>tag, which includes thehrefattribute to specify the destination URL. - Images: Included with the
<img>tag, which requires thesrcattribute to define the image source.
Example of a Simple HTML Page
Here’s a simple example that combines several elements:
<!DOCTYPE html>
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
<h1>My First Webpage</h1>
<p>This is my first paragraph on my webpage.</p>
<a href="https://www.example.com">Visit Example.com</a>
<img src="image.jpg" alt="A sample image" />
</body>
</html>
Conclusion
HTML is a foundational language for web development. By learning its syntax and structure, you’re well on your way to creating attractive and functional websites. As you progress, you can explore CSS (Cascading Style Sheets) for styling and JavaScript for interactivity, making your web pages more dynamic. Happy coding!