HTML stands for Hyper Text Markup Language. HTML is the standard language used to create and design web pages. It forms the backbone of almost every website on the internet. HTML allows us to structure content on the web, including text, images, links, forms, and more. Here’s a brief introduction to the key concepts of HTML are
1. Structure of HTML Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</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 HTML document.
<meta charset="UTF-8">
: Defines the character set for the document.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
: Helps in
rendering web pages properly on different devices.
<title>
: Sets the title of the webpage (displayed on the browser tab).
<body>
: Contains the content of the webpage.
Save the above code into file with “.html” extension and open that file in browser by double click on that file or open with in browser.
2. HTML Elements
HTML is made up of elements, which are the building blocks of a webpage.HTML is made up of elements,
which are the building blocks of a webpage.Elements are represented by tags, such as
<p>
for
paragraphs,
<h1>
for headers,
<a>
for links, and so on.
3. Text and Headings
Use heading tags <h1>
to <h6>
for different levels of headings.Use paragraph tags <p>
for text paragraphs.Use tags like <strong>
for bold and <em>
for emphasis (italics).
4. Lists
Ordered lists (<ol>
) and unordered lists
(<ul>
) are used for creating lists.List items are denoted by
<li>
.
5. Links
Create hyperlinks using the <a>
(anchor) tag.Example: <a href="https://www.example.com">Visit Example.com</a>
.
6. Images
Embed images using the <img>
tag.Example: <img src="image.jpg" alt="Description">
.
7. Forms
Forms (<form>
) are used for user input.Input elements include text boxes, radio buttons, checkboxes, etc.
<form>
<label for="username">Username:</label>
<input type="text" id="username" name="username">
<input type="submit" value="Submit">
</form>
8. Comments
Use <!-- Comment goes here -->
for adding comments in the HTML code.
9. Attributes
HTML elements can have attributes that provide additional information.Example: <img src="image.jpg" alt="Description">
, where src
and alt
are attributes.