We Split Notes
We Split Notes
UNIT – II
WEB DESIGNING
HTML – Form Elements - Input types and Media elements - CSS3 - Selectors, Box
Model, Backgrounds and Borders, Text Effects, Animations, Multiple Column
Layout, User Interface.
2.1. HTML:
HTML stands for HyperText Markup Language. Hypertext is simply a piece of text that works
as a link.
Markup Language is language of writing layout information within documents.
Basically an HTML document is a plain text file.
It contains rich text. The rich text means text with tags.
HTML is not a case sensitive language.
Any HTML program can be written in simple Notepad or WordPad text editors. The extension
to this program should be either html or htm.
This program then can be opened in some web browser and the corresponding web page can be
viewed. Let us create our first web page using HTML.
2
lOMoARcPSD|39184047
Script Explanation
1) Note that the program consists of some strings enclosed within angular brackets.
Such strings are called tags.
2) The HTML program should be written within <html> and </html>. The <html> indicates
the start of html program and </html> denotes end of html program. Use of slash (/) in the
angular bracket indicates end of that particular tag.
3) Any HTML program has two prominent parts : head and body. The head part acts as a header of a
file and contains some information like setting the title of web page.
2.1.3. Comments in HTML
The comment in HTML can be denoted as follows -
<!--It is a comment statement -->
There should not be a space between angular bracket and exclamation mark. This comment is
beginning with <!-- and ending with -->. Also note one thing that there should not be any -- inside
the comment.
2.1.4. Some Fundamental HTML Elements
In all HTML/XHTML documents the root element is <html> which has two children : head
and body.
Any text contained within the head element does not appear directly in the client area of web
browser. The head element is used for providing certain information to web browser. The <title>
element is used to give title to the web page. Note that this title does not appear in client area.
Rather it appears at the top of web browser.
The <body> element contains the information which is to be displayed in the client area of
web browser.
The body element can contain several fundamental elements such as <p>, <h1>, <div>,
<a>, <hr>, <br> and so on. The elements within the body part is for deciding the layout of your
web page.
2.1.5. Heading
There are header tags which help to display the text as some header.
The header tag is denoted by h1, h2 and so on upto h6.
3
lOMoARcPSD|39184047
Following HTML document along with its output is itself self explanatory.
HTML Document [headerDemo.html]
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1> This is a first header </h1>
<h2> This is a second header </h2>
<h3> This is a third header </h3>
<h4> This is a forth header </h4>
<h5> This is a fifth header </h5>
<h6> This is a sixth header </h6>
</body>
</html>
OUTPUT
2.1.6. Paragraphs
Following are the tags that are used for creating paragraphs
Tag Meaning
<p> This tag should be put at the end of every paragraph.
<pre> This tag is used to preserve the white spaces and lines in the text.
<div> This tag is used to make division of sections in the XHTML document.
Table 2.1. Paragraph Tags
For example
HTML Document[TextFormat.html]
<!DOCTYPE html>
<html >
4
lOMoARcPSD|39184047
<head>
</head>
<body>
<p>
Once upon a time, there was a king who kept a monkey as a pet The monkey served the king by all
the possible ways.
</p>
<div>
It was very hot in those days. So one day, when the king was sleeping, monkey was
fanning the king. Suddenly monkey noticed a fly on the chest of the king. The monkey
tried to swish it away. But fly would go away for one moment and come back again.
</div>
<div> So monkey decided to teach a lesson to the fly.</div>
<pre>
The monkey then looked for something to hit a
fly. It then found a stick.
It picked up the stick and tried to beat the fly using stick.
Hmmm at last it found a fly and
with all the force it hit the fly as a result of which the king died.
OUTPUT
5
lOMoARcPSD|39184047
</head>
<body>
<p>
Here the line breaks <br/> and new line
starts. Again line breaks<br/> Bye.
</p>
</body>
</html>
OUTPUT
6
lOMoARcPSD|39184047
Tag Purpose
<b> </b> Displays the text in bold
<i> </i> Displays the text in
italics
<strong> Displays the text in bold
</strong>
<strike> </strike> Displays the text with
strike
OUTPUT
7
lOMoARcPSD|39184047
We can align the text at left, right or at the center using a <div> tag. Here is a HTML program
which shows the text aligned left, right and centre.
HTML Document[TextAlign.html]
<!DOCTYPE html >
<html>
<head>
<title>Font Style Demo</title>
</head>
<body>
<div align="center">This line is aligned at center</div>
<div align="left">This line is aligned at left</div>
<div align="right">This line is aligned at right</div>
</body>
</html>
OUTPUT
We can set the font, size and color of the text in the web page. The tag <basefont> is used for
this purpose. The optional attributes used with <basefont> tag are as given below:
color Color value such as “red”, It displays the text with specified
“yellow” color.
and so on.
8
lOMoARcPSD|39184047
Example:
HTML Document[SetFont.html]
<!DOCTYPE html>
<html >
<head>
<title>Setting the Text </title>
</head>
<body>
<basefont face="arial" size="10">
Varsha is sweet and <br/>
Jayashree is very naughty!!<br/>
But Sachin is a serious guy<br/>
And Rashmi is a new-comer in this group
</body>
</html>
OUTPUT
HTML Document[BgColor.html]
<!DOCTYPE html>
9
lOMoARcPSD|39184047
<html>
<head>
<title>Coloring the background</title>
</head>
<body bgcolor="#FFFF00">
<h3>This document has colored background</h3>
</body>
</html>
OUTPUT
Example:
SOURCE CODE:
mainpage.html
<html>
<head></head>
<frameset rows="15%,*">
<frame src="top.html" />
<frame src="bottom.html" />
10
lOMoARcPSD|39184047
</frameset>
</html>
top.html
<html>
<body bgcolor="blue">
<font face="verdhana" size="20" color="pink">
<center><b>IT COMPUTER CENTRE</b><center>
</font>
<font color="pink">
<marquee scrolldelay="100" width="50%">(A Government approved Private Computer
centre)</marquee>
</font>
</body>
</html>
bottom.html
<html>
<head />
<frameset cols="21%,50%,*" border="2">
<frame src="col1.html" name="col1"/>
<frame src="col2.html" name="col2"/>
<frame src="col3.html" name="col3" />
</frameset>
</html
col1.html
<html>
<head>
<font color="red"><center><b>ADVERTISEMENT</b></center></font>
</head>
11
lOMoARcPSD|39184047
<body bgcolor="navy">
<br/><br/><br/>
col2.html
<html>
<head><center><font color="orange"><h1>
<marquee width="40%" behavior="alternate">WELCOME TO IT COMPUTER CENTER
!!!</marquee>
</h1></font></center>
</head>
<body bgcolor="olive">
<h2>
<ul>
<li><a href="about.html" target="col2">About Us</a> <br/><br/><br/> </li>
<li><a href="Course_Details.html" target="col2">Course Details</a> <br/><br/><br/> </li>
<li><a href="features.html" target="col2">Features</a> <br/><br/><br/></li>
<li><a href="contact.html" target="col2">Contact Us</a> <br/><br/><br/> </li>
</ul>
</h2>
</body>
</html>
about.html
<html>
12
lOMoARcPSD|39184047
course_details.html
<html>
<head><font color="blue"><h2>COUSE DETAILS</h2></font></head>
<body bgcolor="cyan">
<hr/>
The following courses are provided:-
<br/><br/><br/>
<font color="blue"><center>
<table border="2" width="60%">
<thead>
<tr><th><h3>Course</h3></th>
<th><h3>Duration</h3>(in months) </th>
</tr>
</thead>
<tbody align="left">
<tr>
13
lOMoARcPSD|39184047
<td align="center">3</td>
</tr>
<tr>
<td>R PROGRAMMING</td>
<td align="center">4</td>
</tr>
<tr>
<td align="center">3</td>
</tr>
<tr>
<td>ASP.NET / VB.NET</td>
<td align="center">3</td>
</tr>
<tr>
<td>COMPUTER SERVICING</td>
<td align="center">6</td>
</tr>
<tr>
<td>CORE JAVA</td>
<td align="center">3</td>
</tr>
<tr>
<td>J2EE</td>
lOMoARcPSD|39184047
<td align="center">6</td>
</tr>
</tbody>
</table>
</center></font>
</body>
</html>
features.html
<html>
<head><font color="blue"><h2>FEATURES</h2></font></head>
<body bgcolor="orange">
<hr/>The following features are provided by us in all coaching centres.<br/><br/>
<h3><font color="blue">
<ul>
<li> Best Classroom Teacing with best Faculty Members</li>
<li> More pratical based training</li>
<li> Online quiz, assignment, and study materials</li>
<li> Scholarship for meritorious students</li>
<li> Industry based Projects</li>
<li> Reputed certificates </li>
</ul>and more.......
</font></h3>
</body>
</html>
contact.html
<html>
15
lOMoARcPSD|39184047
<body bgcolor="cyan">
<hr/>For futher details contact us:<br/><br/><br/>
<pre><b>
Main Branch Address:<font color="blue"><h3>
NO. 100, CK Towers,
2<sup>st</sup> Floor,
MTH Road,
AVADI,
</body>
</html>
col3.html
<html>
<head />
<frameset rows="45%,*">
<frame src="login.html" />
login.html
<html>
<head><font color="YELLOW"><center>LOGIN PAGE</center></font></head>
<body bgcolor="teal">
16
lOMoARcPSD|39184047
</body>
</html>
result1.html
<head />
<body>
<h2><font color="blue"><pre>
"LOGGED IN
SUCCESSFULLY"
</pre></font></h2>
</body>
</html>
join.html
<html>
<head><font color="orange"><center><b>JOIN AS A
MEMBER</b></center></font></head>
<body bgcolor="cyan">
<pre><form method="get" action="result2.html">
Enter your Name : <input type="text" size="20"/><br>
Enter your Email-ID: <input type="text"
size="20"/><br>
Enter your Password: <input type="password" size="15"><br>
17
lOMoARcPSD|39184047
You are a:
<input type="radio" name="c1" value="School student" /> School Student
result2.html
<html>
<head />
<body>
<h2><font color="blue"><pre>
"SUBMITTED
SUCCESSFULLY"
</pre></font></h2>
</body>
</html>
18
lOMoARcPSD|39184047
new.html
<html>
19
lOMoARcPSD|39184047
An HTML form is used to collect user input. The user input is most often sent to a server for
processing.
Example:
The HTML <form> element is used to create an HTML form for user input:
The <form> element is a container for different types of input elements, such as: text fields,
checkboxes, radio buttons, submit buttons, etc.
An <input> element can be displayed in many ways, depending on the type attribute.
20
lOMoARcPSD|39184047
The <input type="text"> defines a single-line input field for text input.
Example
<html>
<body>
<form>
</form>
<p>Also note that the default width of text input fields is 20 characters.</p>
</body>
</html>
21
lOMoARcPSD|39184047
Output:
elements.
The <label> element is useful for screen-reader users, because the screen-reader will read out loud the
label when the user focus on the input element.
The <label> element also help users who have difficulty clicking on very small regions (such as radio
buttons or checkboxes) - because when the user clicks the text within the <label> element, it toggles
the radio button/checkbox.
The for attribute of the <label> tag should be equal to the id attribute of the <input> element to bind
them together.
Example:
<html>
<body>
<h2>Radio Buttons</h2>
22
lOMoARcPSD|39184047
<form>
<label for="html">HTML</label><br>
<label for="css">CSS</label><br>
<label for="javascript">JavaScript</label>
</form>
</body>
</html>
OUTPUT:
2.2.6. Checkboxes
Checkboxes let a user select ZERO or MORE options of a limited number of choices.
Example:
<html>
<body>
<h2>Checkboxes</h2>
23
lOMoARcPSD|39184047
<form action="/action_page.php">
</form>
</body>
</html>
OUTPUT:
Example:
The <input type="submit"> defines a button for submitting the form data to a form-handler.
The form-handler is typically a file on the server with a script for processing input data.
Example:
24
lOMoARcPSD|39184047
<html>
<body>
<h2>HTML Forms</h2>
<form action="/action_page.php">
</form>
<p>If you click the "Submit" button, the form-data will be sent to a page
called "/action_page.php".</p>
</body>
</html>
OUTPUT:
Notice that each input field must have a name attribute to be submitted.
If the name attribute is omitted, the value of the input field will not be sent at all.
25
lOMoARcPSD|39184047
Example:
<html>
<body>
<form action="/action_page.php">
</form>
<p>If you click the "Submit" button, the form-data will be sent to a page
called "/action_page.php".</p>
<p>Notice that the value of the "First name" field will not be submitted, because the input element
does not have a name attribute.</p>
</body>
</html>
OUTPUT:
<html>
26
lOMoARcPSD|39184047
<body>
<form action="/action_page.php">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
<input type="submit">
</form>
</body>
</html>
OUTPUT:
27
lOMoARcPSD|39184047
Example:
<html>
<body>
<h2>Textarea</h2>
<form action="/action_page.php">
<br><br>
<input type="submit">
</form>
</body>
</html>
OUTPUT:
The rows attribute specifies the visible number of lines in a text area.
28
lOMoARcPSD|39184047
<html>
<body>
</body>
</html>
OUTPUT:
2.3. CSS
29
lOMoARcPSD|39184047
Each declaration includes a CSS property name and a value, separated by a colon.
Multiple CSS declarations are separated with semicolons, and declaration blocks
are surrounded by curly braces.
Example:
p{
color: red;
text-align: center;
}
Example Explained
p is a selector in CSS (it points to the HTML element you want to style: <p>).
color is a property, and red is the property value
text-align is a property, and center is the property value
Example:
<html>
<head>
<style>
body {
background-color: lightblue;
}
h1 {
color: white;
text-align: center;
}
p{
font-family: verdana;
font-size: 20px;
}
</style>
</head>
<body>
30
lOMoARcPSD|39184047
<p>This is a paragraph.</p>
</body>
</html>
OUTPUT:
1. External CSS
2. Internal CSS
3. Inline CSS
With an external style sheet, you can change the look of an entire website by changing just one file!
Each HTML page must include a reference to the external style sheet file inside the <link> element,
inside the head section.
Example:
<html>
<head>
</head>
<body>
31
lOMoARcPSD|39184047
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
An external style sheet can be written in any text editor, and must be saved with a .css extension.
The external .css file should not contain any HTML tags.
"mystyle.css"
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}
OUTPUT:
An internal style sheet may be used if one single HTML page has a unique style.
32
lOMoARcPSD|39184047
The internal style is defined inside the <style> element, inside the head section.
Example:
<html>
<head>
<style>
body {
background-color: linen;
h1 {
color: maroon;
margin-left: 40px;
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
OUTPUT:
33
lOMoARcPSD|39184047
An inline style may be used to apply a unique style for a single element.
To use inline styles, add the style attribute to the relevant element. The style attribute can contain any
CSS property.
Example:
<html>
<body>
</body>
</html>
OUTPUT:
34
lOMoARcPSD|39184047
35