HTML Notes
HTML Notes
Introduction
HTML is an acronym for Hyper Text Markup Language. It is the standard markup
language for documents designed to be displayed in a web browser. it defines the content
and structure of web content. A Markup Language is a set of instructions often called tags
which can be added to text files. HTML is only a formatting language are not a
programming language.
Hyper Text refers to the way in which Web pages (HTML documents)
are linked together. Thus, the link available on a webpage is called
"HyperText".
Markup Language, which means you use HTML to simply "mark up" a
text document with tags that tell a Web browser how to structure it to
display.
What is an HTML Element?
An HTML element is a basic building block to create a webpage, and It is created by
a start tag, content, and end tag. In an HTML element, the content is placed between
a start and end tag.
The basic syntax of an HTML element is
Attributes
Tags have properties that can optionally be assigned values to change default behaviour
of these tags. These properties are called attributers. Attributes are placed within the
starting tag. So, even standalone tags may have attributes.
For example
<hr width=”150”>
This tag represents horizontal rule whose length is specuified by the attribute width
as 150 pixels. Multiple attributes can be specified by separting them by white
space(s).
B. JOGA RAO SWAMI VIVEKANANDA INSTITUTE OF TECHNOLOGY(SVIT)DEPT. CSE(IOT)
For Example
<hr width=150” color=”red”>
Example:
<html>
<head>
<title>First Webpage</title>
</head>
<body>
This is my first page
</body>
</html>
3. bgproperties:- It Indicates if the background should scroll when text does. If we set
it to“FIXED”, the background will not scroll when the text does.
4. text:- specifies color of text in the browser.
5. link:-specifies color of hyperlink that have not yet visited.
6. alink:- specifies the color of link that is being clicked.
7. vlink:-specifies the color of hyperlinks as they have been visited.
Everything within these characters sequences will be ignored by the browsers and
will not be parsed. Comments are used to explain the purpose of critical tahgs in a
HTML
[Link] Breaks
Browsers ignore the new line characters in the HTML source file and text is
displayed continuously. The tag <br> is used to insert a line break.
< br>
[Link] tag
When content was enclosed within <center> and </center> tags, web browsers
would render that content centered horizontally on the page or within its parent
element.
Example
<center>
<h1>This heading is centered using the center tag.</h1>
4.<Marquee> tag
The <marquee> tag allows content enclosed within it to scroll horizontally (left or
right) or vertically (up or down) across the screen. Its behavior can be customized
using various attributes:
direction: Specifies the scrolling direction (e.g., "left", "right", "up", "down").
scrollamount: Controls the speed of the scrolling content.
behavior: Defines how the marquee behaves (e.g., "scroll", "slide", "alternate").
loop: Determines how many times the animation repeats (e.g., "infinite" or a
number).
bgcolor: Sets the background color of the scrolling area.
height and width: Control the dimensions of the marquee box.
Example
<marquee direction="right" scrollamount="5" behavior="alternate" loop="infinite"
bgcolor="#f0f0f0"> This is a scrolling message!
</marquee>
Text Styles
To set default font style, color etc, we use the <basefont> ta. The face, size and color
attributes are used to specify font style, font size and font color respectively. The
following code sets the font style “arail” , font size “2” and font color “red”.
The Font size attribute is used to adjust the size of the text in the HTML document using
a font tag with the size attribute. The range of size of the font in HTML is from 1 to 7 and
the default size is 3.
The Font color is used to set the text color using a font tag with the color attribute in an
HTML document. Color can be specified either with its name or with its hex code.
3. Bold Text
The tag <b> makes the enclosed text bold.
Example:
<b> SVIT </b>
4. Underline text
The tag <u> tag makes the enclosed text underlined.
Example
<u> SVIT</u>
5. Italicized text
The <i> is used to make the enclosed text italic.
Example
<i> SVIT</i>
6. Combining styles
The styles tags can be combined. To get a bold and underlined text, <b> tag and <u>
tag can be combined in any order as long as they are nested correctly.
Example
HTML = <b><u><i>Hyper Text MarkUp Language<i></u></b>.
7. Heading
HTML provided tags for section headings. There are total six levels of headings
h1 through h6. The h1 heading has the largest and h6 has the smallest font size.
The exact size is determined by the browser used. Consider the following HTML
code.
9. Paragraph
Web browsers ignore new line characters encountered in the HTML document.
HTML provides a paragrapgh tag <p> which is used to start a fresh paragrapg. The
tag <p> inserts a blank line immediately before the new paragraph.
Example
<pre> SVIT is an Engineering Collge</pre>.
The HTML <sub> element defines subscript text. Subscript text appears half a
character below the normal line, and is sometimes rendered in a smaller font.
Subscript text can be used for chemical formulas, like H2O:
Example
H<sub>2 </sub>O
12. SuperScript
The HTML <sup> element defines superscript text. Superscript text appears half a
character above the normal line, and is sometimes rendered in a smaller font.
Superscript text can be used for footnotes, like WWW[1]:
Example
(a+b)<sup>2 </sup>
<ul>
<li>unordered List</li>
<li>ordered List</li>
<li>Definition List</li>
</ul>
Output
unordered List
ordered List
Definition List
This code creates an unordered list of three items. The type attribute of the <ul>
tag specifies the bullet option.
Unordered List
In this type of list, items are displayed using numbers. The list is created using the
<ol> tag and items are created using the <li> tag. Note that an item itself may
be a separate ordered or unordered list.
<ol>
<li>unordered List</li>
<li>ordered List</li>
<li>Definition List</li>
</ol>
Output
1. unordered List
2. ordered List
3. Definition List
This HTML code creates the same list of ordered items. The different numbering
options for ordered list is shown below
Numbering Numbering
Meaning Result Meaning Result
options options
Use small
Use default 1. One a. One
<ol> <ol type=’a’> letters for
number type 2. Two b. Two
numbering
Use small
1. One d. One
<ol use default <ol type=’a’ letters
2. Two e. Two
type=’1> number type start ‘4’> starting
from d
Definition Lists
A definition list is one where list items consists of two parts: a term and its
description. It is created using the <dl> tag. The term part and the definition part
and the definition part of each item are created using <dt> (Definition term) and
<dd> (definition description) tags respectively.
<dl>
<dt>dl tags</dt>
<dd> it is the outermost tag of definition list</dd>
<dt>dt tags</dt>
<dd>contains item to be described</dd>
<dt>dd tags</dt>
<dd> contains description of the item</dd>
<dd> each term may have multiple description</dd>
</dl>
OUPUT
dl tags
it is the outermost tag of definition list
dt tags
contains item to be described
dd tags
contains description of the item
each term may have multiple description.
Nested Lists
Nested lists may be used to display sub-elements of an item. Any of the three
types of lists may be nested in another. Arbitrary levels of nesting is possible. In the
following example n ordered list is nested in a unordered list.
<body bgcolor="pink">
<h1 align=center><b><u>Nested List</u></b></h1>
<font size=5>
<ol>
<li>Subjects
<ol>
<li>Mathematics</li>
<li>Science</li>
<li>Literature</li>
</ol>
</li>
<li>Programming languages
<ol>
<li>C</li>
<li>Java</li>
<li>python</li>
<li>Ruby</li>
<li>swift</li>
</ol>
</li>
</li>
<li>Computer Science Concepts
<ol>
<li>Data structures</li>
<li>Algorithms</li>
<li>Operating systems</li>
<li>Database management</li>
<li>Networking</li>
</ol>
</li>
<li>web technologies</li>
<ol>
<li>HTML</li>
<li>CSS</li>
<li>javaScript
<ol>
<li>React</li>
<li>Angular</li>
<li>Vue</li>
</ol>
</li>
<li>BootSTrap</li>
</ol>
</ol>
<html>
<head>
<title> Anchor tag Demo</title>
</head>
<body bgcolor="pink">
<a href="mailto: abc@[Link]">Click here to mail</a>
</body>
</html>
<pre id="HTML">
<font size="12">
<b>HTML</b> Stands for <b><i>HyperText Markup Language</b></i>,
where,
HyperText stands for Link between web pages.
Markup Language means Text between tags that define the structure.
HTML is a markup language that is used to create web pages. It defines how the
web page looks and how to display content with the help of elements. It forms
or defines the structure of our Web Page, thus it forms or defines the structure of
our Web Page. We must remember to save your file with .html extension.
</font>
</pre>
<pre id="CSS">
<font size="12">
What is CSS?
CSS stands for Cascading Style Sheets. It is the language for describing the
presentation of Web pages, including colours, layout, and fonts, thus making our
web pages presentable to the users.
CSS is designed to make style sheets for the web. It is independent of HTML
and can be used with any XML-based markup language. Now let’s try to break
the acronym:
Cascading: Falling of Styles
Style: Adding designs/Styling our HTML tags
Sheets: Writing our style in different documents
</font></pre>
<p> </p><p> </p><p> </p><p> </p><p> </
p><p> </p><p> </p><p> </p>z<p> </p><p> </
p><p> </p><p> </p><p> </p><p> </p><p> </p>
<pre id="JAVASCRIPT">
<font size="12">
JavaScript is an open-source programming language designed for creating web-
centric applications. It is lightweight and interpreted which makes it much faster
than other languages and is integrated with HTML making it easier to
implement in web applications.
In this Introduction to JavaScript article, you will learn all about JavaScript, the
backbone of web development, and understand what exactly this language is
and why and how this language is used across various fields.
JavaScript is critical for web development, and if you’ve ever thought about
choosing that career path, you’d surely have come across this language. And
probably, that’s why you are here in the first place.
</font>
</pre>
Onclicking the Introduction to HTML HyperLink, the control navigates to the section
where Introduction to HTML is available.
Introduction to Frames
HTML frames are used to divide your browser window into multiple sections
called frames where each frame can load a separate HTML document
independently. So, frames allows us display multiple HTML document in one
browser window simultaneously. They are refreshed separately. A collection of
frames in the browser window is known as frameset.
Where,
name refers to name of the frame
src specifies the location of the intital web page to be loaded.
scrolling specifies the scroll information about the frame. It can
have the following values
1. auto----specifies that the scroillbar will be added as and
when necessary
2. yes------specifies that scrollbars are to be added always.
3. No --- specified that no scrollbars will be provided.
noresize if present, indicates that the frame is not resizable
Frameborder specifies the border information about the frame. It can
have the following values
1. "1" indicates that a border will be drawn
2. "0" indicates that the frame will not any border.
Example 1: Dividing the browser into two vertical frames
[Link]
<html>
<head>
<frameset cols="30%,70%">
<frame src="[Link]">
<frame src="[Link]">
</frameset>
</head>
<body>
</body>
</html>
<html>
<body bgcolor="pink">
<title>Frame demonstration</title>
<h1 align="center"> First Frame</h1>
</body>
[Link]
<body bgcolor="green">
<h1 align="center"> second Frame</h1>
</body>
[Link]
<html>
<head>
<frameset cols="30%,70%">
<frame src="[Link]">
<frame src="[Link]">
</frameset>
</head>
</html>
[Link]
<html>
<body bgcolor="green">
<h1 align="center"> second Frame</h1>
</body>
</html>
Example 3: Dividing frame into two rows and then in second row was divided
vertically into two.
[Link] [Link]
<html> <html>
<head> <body bgcolor="green">
<title>Frame demonstration</title> <p> </p>
<frameset rows="30%,70%"> <p> </p>
<frame src="[Link]"> <p> </p>
<frameset cols=50%,50%> <h1 align="center"> second Frame</h1>
<frame src="[Link]"> </body>
<frame src="[Link]"> </html>
</frameset>
</frameset>
HTML form
The HTML <form> tag is very important tag, it is used to create an HTML form for
user input. It acts as a container for various input element allowing you to collect
data from users on a web page.
Its primary purpose is to gather information provided by users,. When a form is
submitted the data collected within the form is sent to a specified location for
processing.
Attributes
1. action:-specifies the URL where the form data should be sent upon submission.
2. method:- which specifies the HTTP method to be used.
3. name:- used to name the form
2. Password field
Password field are similar to text field except that characters entered are displayed
as dots or asterisk. This allows us to hide information from others. It is commonly
used to accept sensitive information such as passwords, credit card numbers etc.
3. Checkbox
A checkbox is like a toggle switch i.e it can be either of the two states checked
or unchecked. Checkboxes allow visitors to select one( or more) options from a
set of related alternatives.
The value attribute stores the value to be returned when the checkbox is [Link]
the attribute value is not present and checkbox is checked, the value “on” is
returned. However if it is not checked, no value is returned.
A check box by default is off. If you want to turn it on use the checked
keyword
4. Radio Button
Radio button allow visitors to select any one among a set of related alternatives.
A radio button like a checkbox, can be in either two states: on(Checked) or
off(unchecked). A group of radio buttons is created by giving the same name to each
button in the group. when one radio button is selected, the previous selected radio
button(if any) is unselected.
A radio button is created using the <input> tag and specifying type=”radio”. The
following code allows you to choose any one among the four options.
<input type=”radio” name=”gender” value=”M”>Male<br>
<input type=”radio” name=”gender” value=”F”>FeMale<br>
6. TextArea
A text area is an extension of a text field, where the text can span multiple lines.
It is used when visitors want to enter a large amount of text. Unlike other form
fields, a text area is created using the <textaraea> and </textarea> tags. Everything
within the tag pair is displayed in the text area. The number of rows and columns
may be set using the attributes rows and cols respectively. The wrap attribute
specifies how the text in a text area is to be wrapped when submitted in a form
If wrap=”soft”
This is the default value. When wrap="soft" is used, the text displayed in the text
area will visually wrap within the element's width, but no newline characters are
added to the submitted value. The submitted text will be a single continuous string,
even if it appears wrapped in the browser.
If Wrap=”hard”,
when wrap="hard" is used, the browser will insert newline characters into the
submitted value at the points where the text visually wraps within the text area. This
means that the submitted text will retain its line breaks as they appeared in the
browser.
Example
<textarea cols=5 rows=5>
SVIT is an acronym for Swami Vivekananda Institute of technology
</textarea>
7. Action Buttons
B. JOGA RAO SWAMI VIVEKANANDA INSTITUTE OF TECHNOLOGY(SVIT)DEPT. CSE(IOT)
In HTML, "action buttons" primarily refer to elements that trigger an event or
perform an action when a user interacts with them. The most common way to
create such buttons is using an <input> element with
1. type="submit",
2. type="reset".
3. type="button",
4. type=file
1. Submit Button is used to send information to the server script whose URL is
specified by the action attribute of the <form> tag. A submit button is created as
follows
<input type=”submit” value=”Submit”>
This code creates a button with caption “Submit” which when clicked sends
form’s data to the server.
2. Reset Button when a reset button is clicked, form field are assigned their
default initial values. It is created as follows
<input type=”reset” value=”Reset”>
3. Button used for general-purpose buttons that typically trigger JavaScript. It is
created as follows
<input type=”button” value=”Click”>
4. File Button: in HTML creates a file upload control on a web page. This allows
users to select one or more files from their local device to be submitted with a
form.
<input type=”file” value=”file”>
The "alt" attribute mainly used to tells the reader what he or she is missing on a
page if the browser can't load images. The browser will then display the alternate
text instead of the image. It is a good practice to include the "alt" attribute for each
image on a page, to improve the display and usefulness of your document for
Example 2
<html>
<body>
<img src=”[Link]” alt=”beautiful flower” width=500 heght=500>
</body>
</html>
<tr>
<td align=center>[Link]</td>
<td>Student name</td>
<td>RollNo</td>
<td>Branch</td>
</tr>
<tr>
<td>1</td>
<td>SriRam</td>
<td>001</td>
<td>IOT</td>
</tr>
<tr>
<td>2</td>
<td>Krishna</td>
Example 2:
HTML Code
<body>
<table border=1>
<tr>
<td rowspan=3>Student marks</td>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
</table>
</body>