Introduction to HTML - Copy
Introduction to HTML - Copy
What is HTML?
HTML (HyperText Markup Language) is the standard language used to create and structure
web pages. It tells web browsers how to display content using tags and elements.
Breaking Down HTML
HyperText: Text that contains links to other web pages or resources.
Markup Language: Uses tags to define elements on a webpage, such as headings,
paragraphs, images, and links.
What is an HTML Tag?
A tag is a keyword enclosed in angle brackets (<>). Tags define different types of content on
a webpage.
Example of an HTML Tag:
<p>This is a paragraph.</p>
<p> is an opening tag (starts the paragraph).
</p> is a closing tag (ends the paragraph).
The content inside is displayed on the webpage.
Types of Tags:
1. Paired Tags (Opening & Closing)
o Example: <p>...</p>, <h1>...</h1>, <div>...</div>
2. Self-Closing Tags (No Closing Tag)
o Example: <img>, <br>, <hr>
In Summary:
Tags define the structure of an element.
Elements include an opening tag, content, and a closing tag (except for self-closing tags).
Every webpage is made up of multiple HTML elements.
<aside> Represents content aside from the main content (e.g., sidebar).
<header>
<h1>Welcome to My Website</h1>
</header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<section>
<article>
<h2>My First Article</h2>
<p>This is a sample article about semantic HTML.</p>
</article>
</section>
<aside>
<h3>Related Links</h3>
<ul>
<li><a href="#">HTML Basics</a></li>
<li><a href="#">CSS Styling</a></li>
</ul>
</aside>
<footer>
<p>© 2025 My Website. All rights reserved.</p>
</footer>
</body>
</html>
Basic Syntax
<form action="/submit" method="post">
<!-- form elements go here -->
</form>
Attribute Description
(input fields):
<input type="text"> <!-- Text field -->
<input type="email"> <!-- Email field -->
<input type="password"> <!-- Password field -->
<input type="submit"> <!-- Submit button -->
<textarea></textarea> <!-- Multi-line text box -->
<select></select> <!-- Dropdown list -->
Example Form
<form action="/submit-form" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name"
required>
<label for="email">Email:</label>
<input type="email" id="email" name="email"
required>
In HTML, attributes provide additional information about elements. They are always
specified in the opening tag of an element and usually come in name="value" pairs.