HTML CSS Web-Technologies Notes
HTML CSS Web-Technologies Notes
LEARNING MATERIAL
INTRODUCTION TO HTML:
HTML Tags:
o End tags which switch a format off also contain a forward slash.
HTML ELEMENTS:
An HTML element is everything from the start tag to the end tag
<p> This is a Paragraph </p>
HTML ATTRIBUTES:
HTML Elements can have Attributes. Attribute provide additional information
about an element and are always specified in the start tag.
Syntax: <tag attributename=”value” > Content </tag>
Sample.html
<html>
<head>
<title> Basic HTML document </title>
</head>
<body>
<h1> Welcome to the world of Web Technologies</h1>
<p> A sample HTML program </p>
</body>
</html>
Output:
1. <html> :
The <html> tag tells the browser that this is an HTML document.
The <html> tag represents the root of an HTML document.
The <html> tag is the container for all other HTML elements .
2. <title>:
defines a title in the browser toolbar
provides a title for the page when it is added to favorites
displays a title for the page in search-engine results
3. <body>:
The <body> tag defines the document's body.
The <body> element contains all the contents of an HTML document, such as
text, hyperlinks, images, tables, lists, etc.
Example: Headings.html
<html>
<head>
<title>Heading Tage</title>
</head>
<body bgcolor=yellow text=blue>
<! - - This is a Comment - - >
<h1 align="left">This is Heading 1</h1>
<h2 align="center">This is Heading 2</h2>
<h3 align="right">This is Heading 3</h3>
<h4>This is Heading 4</h4>
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 13
Example: Link.html
<html>
<body>
<a href="http://www.google.com" target="_self"> GOOGLE</a>
<br>
<a href="http://www.yahoo.com" target="_blank">YAHOO</a>
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 14
<br>
<a href="Headings.html" target="_parent"> My Page</a>
</body>
</html>
Output:
8. <font>:
The <font> tag specifies the font face, font size, and color of text.
Attribute Value Meaning
Color rgb(x,x,x) Specifies the color of text
#xxxxxx
colorname
Face font_family Specifies the font of text
Size Number Specifies size of text
9. <link>:
The <link> tag defines a link between a document and an external resource.
The <link> tag is used to link to external style sheets.
11. <br>:
The <br> tag inserts a single line break.
The <br> tag is an empty tag which means that it has no end tag.
Example: TextFormattingTags.html
<html>
<body>
<h1>This is Heading 1</h1>
<b>This text is in bold</b><br>
<i>This text is in Italics</i><br>
<u>This text is in Underlined</u><br>
<strike>This text is Striked</strike><br>
<em>This text is Emphasized</em><br>
<tt>This text is Type Writer Text</tt><br>
<big>This text is Bigger</big><br>
<small>This text is Smaller</small><br>
H<sub>2</sub>O<br>
(a+b)<sup>2</sup>=a<sup>2</sup>+2ab+b<sup>2</sup><br>
<center>This Text is aligned to Center</center><br>
</body>
</html>
Output:
13. <marquee>:
It is used for Scrolling images and text in the web page
Attribute Value Meaning
Scroll, slide
behavior Defines the type of scrolling.
alternate
rgb(x,x,x)
Deprecated-Defines the direction of scrolling the
bgcolor #xxxxxx
content.
colorname
Up, down,
direction Defines the direction of scrolling the content.
left, right
1. ORDERED LIST:
These are those in which the items are arranged in some specific order.
This list can be numerical or alphabetic.
<ol> tag: The <ol> tag defines an ordered list.
Attributes :
Name Value Meaning
1
A
Specifies the kind of marker to use
type a
in the list
I
i
Specifies the start value of an
start number
ordered list
Specifies that the list order should
reversed reversed
be descending
<ol type="A">
<li>Red</li>
<li>Green</li>
<li>Blue</li>
</ol>
<ol start=3 type="i">
<li>Red</li>
<li>Green</li>
<li>Blue</li>
</ol>
</body>
</html>
Output:
2. UNORDERED LIST:
The Unordered lists are those in which the items are not arranged in any
order.
This defines a Bulleted List.
<ul> tag: defines an unordered (bulleted) list.
Attributes:
Name Value Meaning
Disc
Specifies the kind of marker to use in
Type Square
the list
Circle
<li>Red</li>
<li>Black</li>
<li>White</li>
</ul>
<ul type="circle">
<li>Red</li>
<li>Black</li>
<li>White</li>
</ul>
<ul type="square">
<li>Red</li>
<li>Black</li>
<li>White</li>
</ul>
</body>
</html>
Output:
3. DEFINITION LIST
These are lists of items that have 2 parts, a term to be defined and the
definition.
This create lists similar to a dictionary.
<dl> tag: defines a definition list. It is used in conjunction with <dt> and
<dd>
<dt> tag: defines a term/name in a definition list.
<dd> tag: used to describe a term/name in a definition list.
Example:
<html>
<body>
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 20
<dl>
<dt>HTML:</dt>
<dd>Hyper Text Markup Language</dd>
<dt>CSS:</dt>
<dd>Cascading Style Sheets</dd>
</dl>
</body>
</html>
Output:
TABLES:
For Systematic arrangement of information we often require Tabular
Structure.
The biggest advantage of using tables on the web page is that the information
gets arranged systematically.
The <table> tag defines an HTML table.
An HTML table consists of the <table> element and one or more <tr>, <th>,
and<td> elements.
The <tr> element defines a table row, the <th> element defines a table header,
and the <td> element defines a table cell.
An HTML table has two kinds of cells:
o Header cells - contains header information (created with the <th>
element)
o Standard cells - contains data (created with the <td> element)
The text in <th> elements are bold and centered by default.
</tr>
<tr>
<td>r1,c1</td>
<td>r1,c2</td>
<td>r1,c3</td>
</tr>
<tr>
<td colspan="2">r2,c1</td>
<td>r2,c2</td>
<td>r2,c3</td>
</tr>
<tr>
<td>r3,c1</td>
<td>r3,c2</td>
<td colspan="2">
<table border="1" bgcolor="cyan" cellspacing="0"
bordercolor="red">
<tr>
<th colspan="2">Nested Table</th>
</tr>
<tr>
<td>One</td>
<td>Two</td>
</tr>
<tr>
<td>Three</td>
<td>Four</td>
</tr>
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 23
</table>
</td>
</tr>
</table>
</body>
</html>
Output:
FORMS:
Form is a typical layout on the web page by which a user can interact with the
web page.
The <form> tag is used to create an HTML form for user input.
The <form> element can contain one or more of the following form elements:
<input> <textarea> <select> <option> <label>
Attributes of <form> tag:
An input field can vary in many ways, depending on the type attribute.
Attributes of <input > tag:
<textarea>:
The <textarea> tag defines a multi-line text input control.
A text area can hold an unlimited number of characters, and the text
renders in a fixed-width font (usually Courier).
The size of a text area can be specified by the cols and rows attributes
Attributes of <textarea > tag:
FRAMES:
HTML Frames divide a browser window into several pieces or panes, each pane
containing a separate HTML page.
Each portion is called as a Frame.
A Collection of Frames in the browser window is known as a Frameset.
HTML Frames allow authors to present documents in multiple views, which
may be independent windows or sub windows.
One of the Key advantages that frames offer is that you can load and reload
single frames without having to reload the entire contents of the browser
window.
<frameset>:
The <frameset> tag defines a frameset.
The <frameset> element holds one or more <frame> elements. Each
<frame> element can hold a separate document.
The <frameset> element specifies how many columns or rows there will be
in the frameset, and how much percentage/pixels of space will occupy each
of them.
Attributes of <frameset> tag:
<frame>:
The <frame> tag defines one particular window (frame) within a <frameset>.
Each <frame> in a <frameset> can have different attributes, such as
border, scrolling, the ability to resize, etc.
Attributes of <frame> tag:
Example:
Frames.html:
<html>
<frameset cols="25%,*,25%">
<frame src="http://www.bing.com" name="f1" noresize>
<frame src="http://www.w3schools.com" name="f2" noresize>
<frame src="Mypage.html" name="f3" noresize>
</frameset>
</html>
Mypage.html:
<html>
<body>
<h1 align="center">This is Frames Demo</h1>
</body>
</html>
Output:
IMAGES:
Images increase the visual appearance of web pages and makes your web pages
more attractive.
The <img> tag defines an image in an HTML page.
The <img> tag has two required attributes: src and alt.
Attributes of <img> tag:
Name Value Meaning
src URL Specifies the URL of an image
Top, bottom
Specifies the alignment of an image according
align middle
to surrounding elements
left, right
alt text Specifies an alternate text for an image
Specifies the width of the border around an
border pixels
image
width pixels Specifies the width of an image
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 28
Example:
<html>
<body>
<br>
<img src="14.jpg" width="400" height="200" align="right">
<img src="C:\\Users\\Admin\\Desktop\\Others\\13.jpg"
width="300" height="250" border="3" alt="Alternative Text">
</body> </html>
Output:
IMAGEMAPS:
An Image Map is a large picture which has areas that the user can click with a
mouse.
Each clickable area on an image map is called as a “HOT SPOT”. It is the area of
the image that provides a link and when clicked by the user navigates to
different pages.
There are 2 types of Image maps:
1. Server – Side Image Maps
2. Client – Side Image Maps
With Client - Side Image maps, the browser indicates which page you should be
taken to based upon where the user clicks.
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 29
With Server - Side Image maps, the browser sends co-ordinates on the image
where the user clicked, to the server and these are processed by a script file on
the server that determines which page the user should be navigated to.
<map>:
The <map> tag is used to define a client-side image-map.
The required name attribute of the <map> element is associated with the
<img>'s usemap attribute and creates a relationship between the image and
the map.
The <map> element contains a number of <area> elements that defines the
clickable areas in the image map.
<area>:
The <area> tag defines an area inside an image-map (an image-map is an
image with clickable areas).
The <area> element is always nested inside a <map> tag.
Attributes of <area> tag:
Name Value Meaning
coords coordinates Specifies the coordinates of the area
Default, rect
shape Specifies the shape of the area
circle, poly
Specifies the hyperlink target for the
href URL
area
_blank
Specifies where to open the target
target _parent, _self
URL
_top, framename
Example:
<html>
<body>
<img src="2.png" width="400" height="400" alt="Cartoon" hspace="10"
vspace="10" align="left" usemap="#imagemap">
<map name="imagemap">
<area shape="rect" coords="0,0,50,50"
href="http://www.google.com"
alt="Search" target="_blank">
<area shape="circle" coords="100,100,25"
href="C:\\Users\\Admin\\Desktop\\1.jpg" alt="Flower">
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 30
<area shape="poly"
coords="200,200,350,200,200,250,350,250,450,225"
href="14.jpg" alt="Car">
<area shape="default" href="http://www.yahoo.com" alt="Search"
target="_blank">
</map>
</body>
</html>
Output:
INTRODUCTION TO CSS:
A Style sheet is a set of Stylistic rules that expresses the Presentation and
Layout of Structured documents (Web Pages).
Using CSS we can determine the style and layout of the web page.
CSS is a style sheet language used to describe the presentation semantics of a
document written in Markup Language.
They allow us to specify rules for how the content of elements within your
document appears.
With CSS, all formatting could be removed from the HTML document and stored
in a separate CSS file.
Advantages of CSS:
1. Improves the formatting capability of a HTML page
2. Reduced Document size
3. Reduced Complexity and repetition – can reuse the same style sheet with
many different HTML documents.
4. Saves time
5. A style sheet can import and use styles from other style sheets.
CSS RULES:
CSS consists of set of rules that determines how the content of elements within
your document should be formatted.
Syntax:
Selector { property1:value ; property2:value; }
CSS rule is made up of 2 parts:
1. Selector
2. Declaration
Selector : Element/ set of elements to which declaration must be applied to
Declaration: (i). Property: CSS Property that is to be applied
(ii). Value: Value of CSS property
Example:
h1
{
font-family : arial;
color : blue;
text-align : center;
}
Grouping of Selectors: Separate selector with a Comma
h1, h2, h3
{
color : blue;
font-family : calibri;
text-align : center;
}
EXAMPLE:
<html>
<head>
<style type="text/css">
p.center
{ text-align:center; }
p.right
{ text-align:right; }
h2
{ text-align:center; color:orange; font-family:calibri; }
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 33
.cl1
{ color:green; }
#id1
{ color:blue; background-color:orange; }
</style>
</head>
<body>
<p class="center">This paragraph is styled by class 'center'</p>
<p class="right">This paragraph is styled by class 'right'</p>
<p class="cl1">This paragraph is styled by class 'cl1'</p>
<p id="id1">This paragraph is selected by ID selector</p>
<h1 class="cl1">This Heading is styled by class 'cl1'</h1>
</body>
</html>
Output:
TYPES OF CSS:
When a browser reads a style sheet, it will format the HTML document
according to the information in the style sheet.
There are three ways of inserting a style sheet:
1. Inline style sheet
2. Internal/Embedded style sheet
3. External style sheet
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Output:
text-decoration:underline;
font-family:calibri;
font-size:30pt;
}
Ext.html:
<html>
<head>
<link rel="stylesheet" href="Mystyle.css">
</head>
<body>
<p class="left">This paragraph is styled by class 'left'</h1>
<p class="center">This paragraph is styled by class
'center'</p>
</body>
</html>
Output:
CSS PROPERTIES:
CSS BACKGROUND PROPERTIES:
background-attachment:fixed;
background-repeat:no-repeat;
}
body
{
background-position:center top;
background-image:url('bunny giving flower.gif');
background-repeat:no-repeat;
background-attachment:fixed;
background-color:green;
}
</style>
</head>
<body>
<h1>This element is Styled</h1>
</body>
</html>
Output:
Example:
TextFont.css:
p.right
{
color:red;
font-size:large;
text-transform:capitalize;
text-align:right;
font-weight:200;
letter-spacing:-3;
word-spacing:5;
}
p.center
{
color:blue;
text-align:center;
text-decoration:underline;
text-tranform:uppercase;
font-style:italic;
font-size:30;
}
.left
{
color:green;
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 39
text-indent:20;
text-decoration:overline;
text-transform:lowercase;
font-family:tahoma;
font-size:small;
font-style:italic;
#id1
{
color:purple;
font-weight:900;
font-family:verdana;
text-decoration:line-through;
text-align:right;
font-variant:small-caps;
font-size:20;
}
TextFont.html:
<html>
<head>
<link rel="stylesheet" type="text/css" href="TextFont.css">
</head>
<body>
<p>This Paragraph is not styled</p>
<p class="left">This paragraph is styled by class left</p>
<p class="right">This paragraph is styled by class right</p>
<p class="center">This pragraph is styled by class center</p>
<p id="id1">This paragraph is styled by id</p>
</body>
</html>
Output:
Example:
Links.html
<html>
<head>
<style type="text/css">
a:link
{
color:red;
font-family:tahoma;
font-size:12pt;
}
a:visited
{
color:green;
font-family:calibri;
font-size:20pt;
text-decoration:underline;
}
a:active
{
color:orange;
font-family:cambria;
font-size:20pt;
}
a:hover
{
color:brown;
font-family:Brush Script MT;
font-size:22pt;
text-decoration:overline;
}
</style>
</head>
<body>
<a href="www.google.com">This is a Link</a>
</body>
</html>
Output:
Example:
<html>
<head>
<style>
ol.b {
list-style-type: upper-roman;
list-style-position:outside;
}
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 42
ul.c {
list-style-type:circle;
list-style-position:inside;
}
ol li
{
background: #ff9999;
}
ul li
{
background: #3399ff;
}
</style>
</head>
<body>
<h1>Styling Lists With Colors:</h1>
<ol class=”b”>
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol>
<ul class=”c”>
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
</body>
</html>
Output:
Example:
<html>
<head>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
text-align: left;
padding: 8px;
}
tr: nth-child(even){background-color: #f2f2f2}
th {
background-color: #4CAF50;
color: white;
}
</style>
</head>
<body>
<h2>Colored Table Header</h2>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Savings</th>
</tr>
<tr>
<td>Indira</td>
<td>Gamini</td>
<td>$200</td>
</tr>
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 44
<tr>
<td>Vineela</td>
<td>Suri</td>
<td>$150</td>
</tr>
</table>
</body>
</html>
Output:
Example:
<html>
<body>
<h1 style="position:relative;left:10;top:10;z-index:3;background-color:yellow">
This is layer 1</h1>
<h1 style="position:relative;left:50;top:-20;z-index:2;background-color:red">
This is layer 2</h1>
<h1 style="position:relative;left:100;top:-50;z-index:1;background-color:green">
This is layer 3</h1>
<br><br><br>
<h1 style="position:relative;left:10;top:10;z-index:2;background-color:yellow">
This is layer 1</h1>
<h1 style="position:relative;left:50;top:-20;z-index:3;background-color:red">
<h1 style="position:relative;left:100;top:-50;z-index:3;background-color:green">
This is layer 3</h1>
</body>
</html>
Output:
Assignment-Cum-Tutorial Questions
SECTION-A
I. Objective Questions
1. Latest version of HTML in use is ____ [ ]
A).4 B).5 C). 6 D). 7
2. HTML Tags are Case Sensitive. (True / false) [ ]
3. ______Tag is used to create Hyperlinks in HTML [ ]
A). link B). href C). a D). src
4. The following <table> tag attribute specifies the space between Cell Wall and
the Content present inside a cell. [ ]
A). Cellspacing B). Cellpadding C).letter-spacing D).word-spacing
5. Match the following
1. src [ ] A). Specifies an image as a client-side image-
map
2. href [ ] B). Specifies the URL of an Image
3. ismap [ ] C). Specifies an image as a client-side image-
map
4. usemap [ ] D). Specifies the destination of a link
6. Which HTML attribute is used to define inline styles? [ ]
A). style B). id C). Class D). styles
7. _______ tag is used to attach External CSS file to a Web Page [ ]
A). a B). link C). href D). style
8. Which of the following property is used to control the scrolling of an image in
the background? [ ]
A). background-attachment B). background
C). background-repeat D). background-position
9. Which CSS property controls the text size? [ ]
A). text-style B). text-size C). font-style D). font-size
10. What is the correct HTML for making a drop-down list [ ]
A). <input type="list"> B). <list>
C). <select> D). <input type="dropdown">
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 47
SECTION-B
II. Descriptive Questions & Problems
1. List out Common HTML tags and design a webpage using them.
2. Elaborate on various types of Lists in HTML and Design the following web
page using HTML lists
3. Explain <table> tag and its sub-tags with an example. Design the following
table structure using HTML
4. Create a HTML table with columns for a country name, national sport,
national flower, national animal and national tree. There must be at least 5
rows in the table.
7. Create a HTML document that has two frames in one column. The top frame,
which must be 20 percent of the column, must have at least four links to
other documents; the bottom frame will display those documents. The links
must be names of the departments in your college; the documents must be
description of the departments.
8. Design the following Registration form using HTML
9. Define CSS and explain in detail different types of cascading style sheets with
examples.
III YEAR-I SEMESTER A.Y.2018-19 CSE
Web Technologies 50
SECTION-C
4. To add a background color for all h1 elements, which of the following HTML
syntax is used ISRO CS - 2015
(A) h1 { background-color :#FFFFFF} [ ]
(B) { background-color :#FFFFFF} . h1
(C) h1 { background-color :#FFFFFF} . h1(all)
(D) h1. all{bgcolor= #FFFFFF}
5. Create a HTML that has five frames. There must be two rows of frames the
first with three frames and the other with two frames. The frames in the first
row must have equal width. The left frame in the second row must be 50
percent of the width of display. Each of the frames in the top row must
display a document that has a form. The left top frame must have two text
boxes, each 30 characters wide, labeled Name and Address. The middle top
must have five radio buttons with color name labels. The right top frame
must have four check boxes, labeled with four kinds of car equipment such
as a CD player and air Conditioning. The two bottom frames must have
images of two different cars. The top row of frames must use 20 percent of
the height of the display.