Welcome to the HTML Tutorial, your comprehensive guide to mastering HTML! In this lesson, we'll dive deep into HTML, a fundamental language for web development. Whether you're a complete beginner or an intermediate learner, we've got you covered! š”
Let's start with the basics. HTML stands for Hyper Text Markup Language, used to structure and present content on the web.
Every HTML document consists of three main parts: <!DOCTYPE>, <html>, and <body>.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First HTML Page</title>
</head>
<body>
<!-- Your content goes here -->
</body>
</html>š Note: <!DOCTYPE> declaration is important for HTML5 documents, it tells the browser about the version of HTML being used.
HTML elements are building blocks of a webpage. They are defined using tags, which consist of an opening tag <element> and a closing tag </element>. Content is placed between these tags.
<h1>Heading 1</h1>
<p>This is a paragraph.</p>š Note: <h1> to <h6> tags are used for headings, <p> is used for paragraphs.
HTML provides several tags to format text.
<b> and <strong> make text bold<i> and <em> italicize text<a> creates a link<p>This text is <b>bold</b> using <b>strong</b> tag. <br>
This text is <i>italic</i> using <i>tag</i>. <br>
<a href="https://codeyourcraft.com">Visit CodeYourCraft!</a>š” Pro Tip: Use <strong> and <em> for semantic meaning instead of <b> and <i>.
HTML offers two types of lists: unordered and ordered.
<ul> and items use <li><ol> and items use <li><ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>Links are crucial for navigating between web pages. The <a> tag creates a hyperlink.
<a href="https://codeyourcraft.com">Visit CodeYourCraft</a>š Note: The href attribute specifies the URL of the linked page.
Adding images to web pages is easy with the <img> tag.
<img src="image.jpg" alt="Description of the image">š Note: The src attribute specifies the image source, and the alt attribute describes the image for screen readers and search engines.
HTML forms allow users to interact with web pages. They consist of <form>, <input>, and <button> elements.
<form action="/submit_form">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<br>
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<br>
<button type="submit">Submit</button>
</form>š Note: The action attribute specifies the URL where the form data is sent, type="text" and type="email" are input types for text and email respectively.
What is the tag used to create a hyperlink in HTML?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First HTML Page</title>
</head>
<body>
<h1>My First HTML Page</h1>
<p>Welcome to CodeYourCraft's HTML Tutorial!</p>
<a href="https://codeyourcraft.com">Visit CodeYourCraft</a>
</body>
</html>Remember, practice makes perfect! Build your own HTML pages and experiment with different tags to master HTML. Happy coding! š”
This is just a starting point for your HTML journey! In the upcoming lessons, we'll explore advanced concepts, best practices, and tips for creating responsive and interactive web pages. š
This tutorial was created by CodeYourCraft. If you found it helpful, please share it with your friends! š¤