Unit-1
Unit-1
¾ A website
b it has
h a distinct
di ti t fully
f ll qualified
lifi d domain
d i
name, such as www.google.com.
CATEGORIES OF TEXT
HTML Tags
<html>
<head>
<title>
Title of the page
</title>
</head>
<body>
Content of the page
p g
</body>
</html>
/h l
HTML File
</html>
General points
Tool bar
Address bar
Status bar
Common HTML tags:
Understanding the following table:
¾ The
Th first
fi t two
t columns
l show
h the
th opening
i and d closing
l i
tags . Note that just a few tags do not have a closing
tag.
g
WIDTH = % of Document to
"number %" Span
SIZE "
SIZE="number"
b " F
Font Si
Size
FACE=“face”
C ace Font
o Face
ace
<B> </B> Bold Text
<I> </I> Italic Text
<STRIKE> </STRIKE> Strike out Text
<SUB> </SUB> Subscript Text
<SUP> </SUP> Superscript Text
Links
Opening Tag Closing Attribute Description
Tag
<BODY>
BODY </BODY>
/BODY Contents of Document
¾ HTML forms
f are usedd to create GUIs on Webb pages
– Usually the purpose is to ask the user for
information
– The information is then sent back to the server
A text field:
<input type="text" name="textfield" value="with an initial value">
A multi
multi-line
line text field
<textarea name="textarea" cols="24" rows="2">Hello</textarea>
A password field:
<input
p type="password"
yp p name="textfield3" value="secret">
Note that two of these uses the input tag, but one uses textarea
Buttons
A submit button:
<input type="submit" name="Submit" value="Submit">
A reset button:
<input type="reset" name="Submit2" value="Reset">
Applain button:
<input type="button" name="Submit3" value="Push
Me">
A checkbox:
<input type="checkbox" name="ckbox”
value="ckbox"
l " kb " checked>
h k d
¾ Additional arguments:
– size: the number of items visible in the list
(default is "1")
– multiple: if set to "true", any number of items
may be selected (default is "false")
Hidden fields
<input type=
type="hidden"
hidden name=
name="hiddenField"
hiddenField
value="nyah">
<-- right
< g t tthere,
e e, don't
do t you see it?
t?
Example
¾An image-map
g p is an image
g with clickable areas.
planets
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.html" >
<area shape="circle"
h " i l " coords="90,58,3"
d "90 58 3" alt="Mercury"
lt "M "
href="mercury.html">
<area shape="circle" coords="124,58,8" alt="Venus" href="venus.html" >
</map>
</body>
</html>
Sun.html Mercury.html
<html>
<ht l> <html>
<ht l>
<head> <head>
<title>Sun</title> <title>Mercury</title>
</head> </head>
<body> <body>
<img src="sun.gif"> <img src="merc.gif">
</body>
/body </body>
/body
</html> </html>
Venus.html
<html>
<head>
<title>Venus</title>
</head>
<body>
<img src="vens.gif">
</body>
</html>
Cascading Style sheets
¾A style is a set of formatting instructions that can be
applied
pp to a piece
p of text.
¾Styles
Sty es de
definee how
ow to display
d sp ay HTML elements
e e e ts .
Selector
h1
{
color: #0000FF; R l
Rule
font-size: 24pt; Declarations
}
Property Value
¾The selector is normally the HTML element/tag you wish
to define.
¾Note:
¾N t If you wantt tto specify
if more than
th one property,
t you
must separate each property with a semicolon. The example
below shows how to define a center aligned paragraph,
paragraph with
a red text color:
p {text-align: center; color:red}
Types of CSS
¾ Inline Styles
¾ Embedded Styles
¾ Linked / External Styles
Inline Styles
¾ Inline st
style
le is a st
style
le that can be defined within
ithin the
basic HTML tag.
Example
<html>
<head>
<title>Embedded Style</title>
<style>
<!--
h1
{
color:red;
text-align:center;
font-family:arial;
background-color:blue;
}
-->
</style>
</head>
<body>y
<h1>This is Heading1</h1>
<h2>This is Heading2</h2>
<h3>This is Heading3</h3>
<h1>This is Heading1</h1>
</body>
</html>
Linked / External Styles
¾E
Externall style
l is
i a style
l that
h can be
b defined
d fi d in
i externall
files called style sheets which can then be used in any
document by including the style sheet using a <link> tag
in the header section.
Link tag
¾ rel tells the browser what type of link you are using.
¾Say that
¾S h you would ld lik
like to have
h two types off paragraphs
h in
i
your document: one right-aligned paragraph, and one center-
aligned paragraph.
paragraph Here is how you can do it with styles:
p.right {text-align:right}
pp.center {text-align:center}
{ g }
¾In the
¾I th code
d below
b l bothb th the
th h1 element
l t andd the
th p element
l t
have class="center". This means that both elements will
follow the rules in the ".center
center" selector:
<h1 class="center">This heading will be center-
aligned</h1>
<p class="center">This paragraph will also be center-
aligned.</p>
Example
<html>
<head>
<title>Embedded Style</title>
<style>
.clr
l
{
color:green;
g ;
background-color:red;
}
</style>
</head>
<body>
<h1
h1 class="clr">This
l " l " Thi is
i Heading1</h1>
H di 1 /h1
<h1>This is Heading1</h1>
g
<h1>This is Heading1</h1>
<p class="clr">This is a paragraph</p>
</body>
</html>
CSS Background Properties
P
Property
t D
Description
i ti V l
Values
border-color Sets the color of the four borders color_name
hex number
hex_number
rgb_number
border-style
y Sets the style
y of the four borders none
hidden
dotted
dashed
solid
double
groove
ridge
inset
outset
border-width Sets the width of the four borders thin
medium
thick
length
border-left-width
border left width Sets the width of the left border border-width
border width