Welcome to our in-depth guide on HTML Formatting! 🎉
HTML, or Hyper Text Markup Language, is the backbone of web development, allowing us to structure and format content on the web. In this lesson, we'll dive deep into the world of HTML formatting, making it easy for both beginners and intermediates to understand.
Before we begin, let's make sure you have a basic text editor installed on your computer. Some popular choices include Notepad (Windows) and Sublime Text (multi-platform).
In HTML, everything is defined using elements, which are enclosed within tags. A tag consists of an opening tag (e.g., <p>) and a closing tag (e.g., </p>).
What is the difference between an opening tag and a closing tag in HTML?
Headings in HTML are used to structure the content. They range from <h1> (most important) to <h6> (least important).
<!DOCTYPE html>
<html>
<head>
<title>My First Heading Example</title>
</head>
<body>
<h1>Welcome to CodeYourCraft!</h1>
<h2>This is a subheading</h2>
<!-- ... more headings here ... -->
</body>
</html>The <p> tag is used to create paragraphs.
<!DOCTYPE html>
<html>
<head>
<title>My First Paragraph Example</title>
</head>
<body>
<p>This is a paragraph.</p>
<p>Another paragraph.</p>
</body>
</html>The <a> tag is used to create hyperlinks.
<!DOCTYPE html>
<html>
<head>
<title>My First Link Example</title>
</head>
<body>
<a href="https://codeyourcraft.com">Visit CodeYourCraft</a>
</body>
</html>The <img> tag is used to embed images.
<!DOCTYPE html>
<html>
<head>
<title>My First Image Example</title>
</head>
<body>
<img src="image.jpg" alt="Description of the image">
</body>
</html>What is the purpose of the `alt` attribute in the `<img>` tag?
Create a simple HTML file with the following elements:
<h1>)<p>)<img>)<a>)Save your file as exercise.html and open it in a web browser to see your work.
In the next sections, we'll explore more advanced HTML tags such as lists, tables, and forms. Stay tuned! 🎉
This lesson covers the basics of HTML formatting, providing a strong foundation for beginners and a refresher for intermediates. With practice, you'll be well on your way to mastering HTML.
Happy coding! 🎓 🚀