HTML Notes
Introduction
HTML (Hypertext Markup Language) is the standard
language used to create web pages. It allows linking
from one location to another using hyperlinks.
Purpose of HTML
HTML defines the structure of a document using various
tags. (Make up Language)
Make up kisko? Content ko
Make up kaise lagayenge ? using Tags
Tags in HTML
Tags are the basic elements used to structure content in
HTML.
Example of a Header Tag
<h1>This is our Title</h1>
Converts ordinary text into header text.
Paragraph Tag
<p>This is a paragraph.</p>
Horizontal Rule (hr) Tag
<hr/>
Line Break (br) Tag
<br/>
Note: Tags like <hr/>, <br/>, and <img/> are self-
closing tags that do not require content.
Div Tag
The <div> tag is a container used to group HTML
elements.
HTML Elements
An HTML element consists of a tag and content:
Tag + Content = HTML Element
Is <hr/> an HTML Element?
Yes, <hr/> is an HTML element even though it does not
contain content.
List Tags
Unordered List (ul)
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
Ordered List (ol)
<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>
Anchor Tag
The <a> tag creates hyperlinks. Attributes are necessary
for it to work.
Example:
<a href="[Link]
Attributes in HTML Elements
Attributes are written inside the opening tag of an
element.
Common Attributes for <a> Tag:
- href: Specifies the URL.
Common Attributes for <img> Tag:
- alt: Provides alternative text for images.
- width and height: Set dimensions for images.
Figure and Figcaption
Instead of using <img> directly, <figure> can group an
image and a caption:
<figure>
<img src="[Link]" alt="Description">
<figcaption>Image Caption</figcaption>
</figure>
Boilerplate Template
A boilerplate is a basic structure required for HTML
documents. In VS Code, typing "!" and pressing Enter
generates a complete boilerplate.
Example:
<!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>
<!-- Content goes here -->
</body>
</html>
Setting Background in Body
<body background="[Link]">
</body>
//Add Background img without css
// You can use some css inside HTML Element
// using attribute style=” CSS CODE”;
Example : <body style="background-repeat: no-
repeat; background-size: cover; "
For CSS we have syntax
Property_name : Propety_value;