Professional Documents
Culture Documents
b. Paragraph Tag
The <p> tag offers a way to structure your text into different paragraphs. HTML paragraph define
using <p> tag.
d. Centering Content
You can use <center> tag to put any content in the center of the page or any table cell.
Example Output
e. Horizontal Lines
Horizontal lines are used to visually break-up sections of a document. The <hr> tag creates a line
from the current position in the document to the right margin and breaks the line accordingly.
Example Output
f. Preserve Formatting
The preformatted tag <pre>.Any text between the opening <pre> tag and the closing </pre> tag.
7 Open Source Software Materials.
Example Output
g. Nonbreaking Spaces
Use a nonbreaking space entity instead of a normal space.
Example
<html>
<head>
<title>Bold Text Example</title>
</head>
<body>
Syntax
<ul type=”value”>
<li>item1
<li>item2
<li>item 3
</ul>
Example for Unordered List:
<html>
<head>
<title>Unordered List Example
</title>
</head>
<body>
<ul type=”square”>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ul type=” disc">
<li>Coffee</li>
<li>Tea
<li>Milk</li>
</ul>
<ul type=”circle">
<li>Coffee</li>
<li>Tea
<li>Milk</li>
</ul>
10 Open Source Software Materials.
<ul type="none">
<li>Coffee</li>
<li>Tea
<li>Milk</li>
</ul>
</body>
<html>
2.Ordered HTML Lists
An unordered list starts with the <ul> tag.
Each list item starts with the <li> tag.
The HTML ol tag is used for ordered list.
There can be different types of numbered list
o Numeric Number (1, 2, 3)
o Capital Roman Number (I II
III)
o Small Romal Number (i ii iii)
o Capital Alphabet (A B C)
o Small Alphabet (a b c)
A type attribute can be added to an ordered
list, to define the type of the marker:
Type Description
type="1" The list items will be numbered with numbers (default)
type="A" The list items will be numbered with uppercase letters
type="a" The list items will be numbered with lowercase letters
type="I" The list items will be numbered with uppercase roman numbers
type="i" The list items will be numbered with lowercase roman numbers
Syntax:
<ol type=”value” start=”value”>
<li>item 1
<li> item 2
<li> item 3
</ol>
Example Program for ordered HTML List:-
<html>
<head>
<title>HTML Lists:Ordered HTML
List</title>
</head>
<body bgcolor="pink">
<h3><center>
<font size="30">
<font color="#800080">
Example Program Using Ordered
List
</font color>
</font size></h3>
<hr size="2" color="yellow">
<ol type="1">
<li>Coffee</li>
Tag Description
Sonoo Jaiswal 60
James William 80
Swati Sironi 82
Chetna Singh 72
Output
7503520801
Mobile No.
9555879135
Example 2 Output
<frameset rows="16%,84%">
<frame src="top.htm" name="top">
<frame src="bottom.htm" name="bottom">
</frameset>
Example 3 Output
<frameset rows="16%,84%">
<frame src="top.htm" name="top">
<frameset cols="50%,50%">
<frame src="left.htm" name="left">
<frame src="right.htm" name="right">
</frameset>
</frameset>
Example 4 Output
<frameset rows="50%,50%" cols="50%,50%">
<frame src="topleft.htm" name="topleft">
<frame src="topright.htm" name="topright">
<frame src="botleft.htm" name="botleft">
<frame src="botright.htm" name="botright">
</frameset>
Attributes of frameset
a. <frameset> Tag Attributes
o Cols
o Rows
o Border
o Frameborder
o Framespacing
b. <frame> Tag Attributes
o Src
o Name
1 . 1 7 C S S S Y N T A X W I T H E X A M P L E
<html>
<head>
</head>
<body>
<p style="font-family:georgia,garamond,serif;">
This text is rendered in either georgia, garamond, or the default serif font
depending on which font you have at your system.
</p>
</body>
</html>
b. Font-style
The font-style property is mostly used to specify italic text. This property has three values.
Normal – The text is shown normally.
Italic – The text is shown in italics.
Oblique – The text is “leaning” which is very similar to italic.
d. Font-Weight
You can control the weight of text in an element with the font-weight property:
font-weight: value;
Possible values are
lighter , normal , 100 , 200 . 300 . 400 . 500 . 600 , 700 , 800 , 900 , bold , bolder
Example:
<html>
<body>
<p style="font-weight:bold;">This font is bold.</p>
<p style="font-weight:bolder;">This font is bolder.</p>
<p style="font-weight:lighter;">This font is lighter.</p>
<p style="font-weight:100;">This font is 100 weight.</p>
<p style="font-weight:200;">This font is 200 weight.</p>
<p style="font-weight:300;">This font is 300 weight.</p>
<p style="font-weight:400;">This font is 400 weight.</p>
<p style="font-weight:500;">This font is 500 weight.</p>
<p style="font-weight:600;">This font is 600 weight.</p>
<p style="font-weight:700;">This font is 700 weight.</p>
<p style="font-weight:800;">This font is 800 weight.</p>
<p style="font-weight:900;">This font is 900 weight.</p>
</body>
</html>
e. Font-Weight
23 Open Source Software Materials.
You can set the size of the text used in an element by using the font-size property.
font-size: value;
There are a lot of choices for values:
larger , large , medium , small , smaller , x-small , xx-small , length , % (percent)
Example:
<html>
<head>
<title>Practice CSS font-size property</title>
</head>
<body>
<p style="font-size:xx-small;"> This font size is extremely small.</p>
<p style="font-size:x-small;"> This font size is extra small</p>
<p style="font-size:small;"> This font size is small</p>
<p style="font-size:medium;"> This font size is medium. </p>
<p style="font-size:large;"> This font size is large. </p>
<p style="font-size:x-large;"> This font size is extra large. </p>
<p style="font-size:xx-large;"> This font size is extremely large. </p>
<p style="font-size:smaller;"> This font size is smaller. </p>
<p style="font-size:larger;"> This font size is larger. </p>
<p style="font-size:200%;"> This font size is set on 200%. </p>
<p style="font-size:20px;"> This font size is 20 pixels. </p>
</body>
</html>
f.Font property
The font property can set the style, weight, variant, size, line height and font:
font: italic bold normal small/1.4em Verdana, sans-serif;
1.22.2 CSS TEXT PROPERTIES
CSS TEXT properties are various type like text color, text-align, text-decoration, letter-spacing and many more properties.
a.CSS Color
CSS color property use to set the Text color. The color value can be specified following three types:
1.Color Name: Orange
2.Color Hexadecimal Code: #FFA500
3.Color RGB: rgb(255, 165, 0)
Example
<body>
<p style="color:orange;">CSS TEXT color name orange</p>
<p style="color:#FFA500;">CSS TEXT color hexadecimal code #FFA500</p>
<p style="color:rgb(255,156,0);">CSS TEXT RGB color code rgb(255,156,0)</p>
</body>
b. CSS text-align
CSS text-align property use to set the horizontal alignment of text.
text-align posible value center, left, right, or justify.
b. Background Color
The background-color property sets the background color of an element.
Syntax:
background-color: <value>
Example
c. Background Image
The background-image property sets the background image of an element.
Syntax:
background-image: <value>
Example
BODY { background-image: url(/images/foo.gif) }
P { background-image: url(http://www.htmlhelp.com/bg.png) }
d. Background Repeat
The background-repeat property determines how a specified background image is repeated.
Syntax:
background-repeat: <value>
Example
BODY { background: white url(candybar.gif);
background-repeat: repeat-x }
e. Background Attachment
The background-attachment property determines if a specified background image will scroll with
the content or be fixed with regard to the canvas.
Syntax:
background-attachment: <value>
Example:
BODY { background: white url(candybar.gif);
background-attachment: fixed }
f.Background Position
The background-position property gives the initial position of a specified background image. This
property may only be applied to block-level elements and replaced elements.
Syntax:
background-position: <value>
Example
background-position: 50% 50%;
g. Background
The background property is a shorthand for the more specific background-related
properties.
Syntax:
background: <value>
Example
BODY { background: white url(http://www.htmlhelp.com/foo.gif) }
BLOCKQUOTE { background: #7fffd4 }
P { background: url(../backgrounds/pawn.png) #f0f8ff fixed }
TABLE { background: #0c0 url(leaves.jpg) no-repeat bottom right }
1. Border-Color Property
The border-color property allows you to change the color of the border surrounding an element. The
Border-Color Properties are:
1. border-bottom-color changes the color of bottom border
2. border-top-color changes the color of top border
3. border-left-color changes the color of left border
4. border-right-color changes the color of right border
Example
<html>
<head>
<style type="text/css">
p.example1{
border:1px solid;
border-bottom-color:#009900; /* Green */
border-top-color:#FF0000; /* Red */
30 Open Source Software Materials.
border-left-color:#330000; /* Black */
border-right-color:#0000CC; /* Blue */
}
p.example2{
border:1px solid;
border-color:#009900; /* Green */
}
</style>
</head>
<body>
<p class="example1">
This example is showing all borders in different colors.
</p>
<p class="example2">
This example is showing all borders in green color only.
</p>
</body>
</html>
2. Border-Style Property
The border-style property allows you to select one of the following styles of border.
none: No border. (Equivalent of border-width:0;)
solid: Border is a single solid line.
dotted: Border is a series of dots.
dashed: Border is a series of short lines.
double: Border is two solid lines.
groove: Border looks as though it is carved into the page.
ridge: Border looks the opposite of groove.
inset: Border makes the box look like it is embedded in the page.
outset: Border makes the box look like it is coming out of the canvas.
hidden: Same as none, except in terms of border-conflict resolution for table elements.
<html>
<head>
</head>
<body>.
<p style="border-width:4px; border-style:none;">
This is a border with none width.
</p>
</body>
</html>
3. Border-Width Property
The border-width property allows you to set the width of an element borders. The following
properties are:
1.border-bottom-width changes the width of bottom border
2.border-top-width changes the width of top border
3.border-left-width changes the width of left border
4.border-right-width changes the width of right border
Example
<html>
<head>
CSS Border Property
</head>
<body>
<p style="border-width:4px; border-style:solid;">
This is a solid border whose width is 4px.
</p>
</body>
</html>