Introduction of HTML
HTML (Hypertext Markup Language) is defined as the standard markup language for creating and structuring web pages. It forms the backbone of the World Wide Web and is essential for creating and rendering web content in web browsers. HTML is not a programming language; rather, it is a markup language used to define the structure and content of web documents.
Here is an introduction to the key concepts and elements in HTML:
1. Elements and Tags:
- HTML documents are constructed using a set of elements, which are represented by tags enclosed in angle brackets (
<
and>
). - Tags define the structure and content of a web page. For example, the
<h1>
tag is used to create a top-level heading, and the<p>
tag is used for paragraphs.
2. Nesting:
- HTML elements can be nested within each other to create a hierarchy of content. For instance, you can place a paragraph (
<p>
) element inside a<div>
element to group content.
3. Attributes:
- Tags can include attributes that provide additional information about the element. Attributes are typically name-value pairs. For example, the
<img>
tag may include an attribute likesrc
to specify the image source.
4. Structure:
- HTML documents have a basic structure that includes a declaration (
<!DOCTYPE>
) specifying the document type, an<html>
element that wraps the entire page, and two main sections:<head>
for metadata and<body>
for the visible content.
5. Head Section:
- The
<head>
section contains metadata, such as the page title, character encoding, and links to external resources like stylesheets and scripts. The title, specified with the<title>
tag, appears in the browser's title bar or tab.
6. Body Section:
- The
<body>
section contains the content that is displayed in the browser. This can include text, images, links, forms, and other multimedia elements.
7. Links and Anchors:
- HTML provides the
<a>
(anchor) tag to create hyperlinks, allowing users to navigate to other web pages or resources. Links are defined using thehref
attribute.
8. Lists:
- HTML supports ordered lists (
<ol>
), unordered lists (<ul>
), and definition lists (<dl>
) for structuring content into items.
9. Forms:
- HTML offers the
<form>
element to create interactive forms for user input. You can include text fields, radio buttons, checkboxes, and other form controls.
10. Images and Media:
- HTML provides the
<img>
tag for embedding images and supports multimedia content like audio and video through tags like<audio>
and<video>
.
11. Semantic HTML:
- HTML5 introduced semantic elements like
<header>
,<nav>
,<article>
, and<footer
, which provide better structure and meaning to web content. These elements help improve accessibility and search engine optimization.
12. Validation:
- It's crucial to write valid HTML to ensure web pages display correctly in different browsers. There are online validation services and tools to check the validity of your HTML code.
13. CSS and JavaScript:
- While HTML defines the structure and content of a web page, styling is done with Cascading Style Sheets (CSS), and interactivity is added using JavaScript. HTML, CSS, and JavaScript work together to create rich web experiences.
HTML is the foundation of web development, and learning how to create well-structured, semantic, and valid HTML documents is a fundamental skill for anyone interested in web design and development. It serves as the building block upon which you can create visually appealing and interactive web applications.
Example:-
<Html> <head> <Title> Code2Night </Title> </head> <body> <H1>This is a heading tag</h1> This is Break Tag<br> <b>This is Bold Tag</b> <br> <i>This is Italic Tag</i> <br> <u>This is underline Tag</u> <br> <strong>This is used like bold tag</strong> <br> <s>100</s>90rs(This is strike tag) <br> H<sub>2</sub>O(This is subscript tag) <br> 15<sup>th</sup>aug(This is Superscript Tag) <br> <font size=7 color=red face="jokerman">This is font Tag with attribute i.e Size,Color and Face</font> <hr color=blue size=4 width=100% align=left>This is horizonal rular tag with attribute. <br> </body> </html>
Result:-