Web Technology Notes Part 2
Web Technology Notes Part 2
Anchor Tag
The anchor tag (<a>) in HTML is used to define hyperlinks, allowing users to navigate to
different pages or resources. It can link to a different webpage, a specific section of the
current page, or even trigger actions like downloading a file or sending an email.
Syntax:
href (Hypertext Reference) attribute: Specifies the destination of the link (URL, file, or
anchor).
Link Text: The clickable part of the link that users see.
Example:
In this example, clicking on the text "Click here to visit Example" will take the user to
"https://www.example.com".
Formatting Tags
Formatting tags are used for formatting the text style. It will become necessary to make
minor changes for the elements in the HTML document. A tag which is used to an individual
character is referred to as a character tag.
• Physical tags
• Logical tags
Physical Tags
In Physical tags, the formatting is done by the user, how the text has to be displayed on the
browser. It controls the physical characteristics and gives the visual effects for the text.
Syntax:
<Tag Name>Characters to be formatted</Tag Name>
Logical Tags
In Logical tags, the formatting is left to the browser how they have to display the text on the
browser which is designed by the user. Logical tags represent the structure and meaning of
a document.
Syntax:
<Tag Name>Characters to be formatted</Tag Name>
HTML Tags
<tagname>content</tagname>
Example:
<B>HELLO</B>
<tagname>
Example:
<BR>
● Headings Tag
Headings are defined with <h1> to <h6> tags. <h1> indicates the largest size for heading
whereas <h6> indicates the smallest size for heading.
Syntax:
● Paragraph Tag
Paragraphs can be used as <p> for opening tag and </p> for closing tag. It adds automa
extra blank line before and after a paragraph when it is executed.
Syntax:
<p>This is a paragraph</p>
Syntax:
Line 1<br>
Line 2
Syntax:
<hr>
● <Font>:
We can use <font> tag to change color of the text by giving color name. By using face, we
can change style of the text like Arial or Times New Roman, etc. We can change size of the
text also. We should include this tag in the <body> tag.
Example:
<font size=7 color="green" face="Arial">Welcome to font tag</font>
● <Blink>:
This tag is little bit notorious because the text which is enclosed between this tag will blink on
and off and it is very difficult to read the text which is enclosed inside the tag. This tag should
be used in the body section.
Example:
<blink>Blink tag Welcomes all of u</blink>
Example:
<div align="center" style="color:red"> welcome to <div> tag which is used to design a block
of code according to the requirement of the user </div>.
Example:
<span align="center" style="color="green">Welcome to <span> tag
● Pre-formatting text <pre>:
This tag is used to display the text exactly how the user is designing without changing
anything because it is already formatted by the user.
Example:
<pre>
Name: ashok
Class: Bcom Illyr
Address: Sec-bad
</pre>
● <Marquee>:
This tag is used to scroll the text on the screen which is used in the Internet Explorer. Some
of the attribute which are commonly used are:
● Behavior - By default, it is scroll. It can take other values such as slide and alternate.
Example:
<marquee align="left" behavior="scroll" height="50" width="250"bgcolor="cyan"
direction="right"> Welcome to Marquee tag </marquee>
HTML Tables
Tables in HTML are used to display tabular data (data in rows and columns). The basic
structure of an HTML table consists of the <table> element, which contains rows (<tr>) and
cells (<td> for data cells or <th> for header cells).
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
<tr>
<td>Row 1, Cell 1</td>
<td>Row 1, Cell 2</td>
<td>Row 1, Cell 3</td>
</tr>
<tr>
<td>Row 2, Cell 1</td>
<td>Row 2, Cell 2</td>
<td>Row 2, Cell 3</td>
</tr>
</table>
Adding Borders:
<table border="1">
<!-- Content here -->
</table>
1. <table> Tag
The <table> tag defines the start of a table. It can include these attributes:
2. <tr> Tag
The <tr> tag defines a table row. It does not have specific attributes for styling but organizes
<td> or <th> tags in one row.
3. <th> Tag
The <th> tag defines a header cell. Its text is bold and centered by default. You can also
style it with CSS.
4. <td> Tag
The <td> tag defines a regular data cell. It can use these attributes:
Lists in HTML
Lists in HTML are used to organize items in a structured format. HTML provides three main
types of lists:
Syntax:
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
Output:
1. Item 1
2. Item 2
3. Item 3
Attributes of <ol>:
Example:
<ol type="I">
<li>Introduction</li>
<li>Body</li>
<li>Conclusion</li>
</ol>
Syntax:
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Cherry</li>
</ul>
Output:
Apple
Banana
Cherry
Attributes of <ul>:
Example:
<ul type="square">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
Syntax:
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
</dl>
Output:
HTML
HyperText Markup Language
CSS
Cascading Style Sheets
● Nested Lists
You can nest one type of list inside another. Nested lists are generally used in Ordered Lists.
Example:
<ul>
<li>Fruits
<ol>
<li>Apple</li>
<li>Banana</li>
</ol>
</li>
<li>Vegetables
<ul>
<li>Carrot</li>
<li>Spinach</li>
</ul>
</li>
</ul>
Output:
Fruits
1. Apple
2. Banana
Vegetables
Carrot
Spinach