Untitled Document



 Introduction to HTML
 Structure of HTML
 Creating First HTML  Document
 Building Your HTML  Document
 Tables
 Frames
 Including Images into  Document
 Including Multimedia
 Developing HTML  FORMS
 Using Style Sheet
 How do Style Sheets  Work?
 How do Style Sheets  Work?
 Some Advantages of  Using Style Sheets
 Implementing Style  Sheets
 
 Implementing Style  Sheets
 Associating Style  Sheets with HTML  Documents
 Developing a Style  Sheet
 Setting Font  Properties
 Setting Text  Properties
 Setting Box  Properties
 Setting Color and  Background  Properties
 Setting Classification  Properties
 Understanding URLs
 Using JavaScript
 Using Java

Copyrights : Layout Galaxy All Rights Reserved
No part of this tutorial may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, mechanical or otherwise, without prior permission in writing from Layout Galaxy.




  Using Style Sheet > Implementing Style Sheets

  Setting Box Properties

Box properties set the margins, borders and padding(between margins and border) for an element. For example, you can set margin-top, margin-right, margin-bottom, or margin-left properties or use the margin shorthand property to set all four at once. You can also set the width and height properties to control an element's size. The float property can make any element behave like a floating image.

Example

<STYLE>
IMG {position:relative;
               top:0;
               left:0;
               border:thick double green}
H1 {padding:10; margin:30}
</STYLE>

In this Exercise you will learn to set the Box properties in a cascading style sheet.

Padding allocates 10 spaces around the contents of an element and a margin of 30 betwen one element and next.

The paragraph indent is increased using the margin and padding attributes.


  Setting Color and Background Properties

You can change the color of any element, including horizontal lines, form elements and tables. Setting background not only means the entire page but also the background of individual elements including images, form elements and tables.

Example

<STYLE>
IMG {position: relative; top:0; left:0; border: thick double green; vertical-align: middle; float: left}
H1 {padding: 10; margin: 30}
HR {color: red; height: 10}
BODY {background: URL (image1.gif)}
P {background: white; padding: 5}
</STYLE>

In this exercise, you will learn to set color and background properties in a cascading style sheet.

The background attribute sets "img.gif" as the background image for the page.

The background attribute here specifies a background color for the paragraphs and the color attribie specifies the text color.

The page displayed with the background image and the paragraph is displayed with the background color yellow and font color green.


  Setting Classification Properties

Classification Properties classify different elements by their behavior and control how elements such as list elements work. For example, you can use the list-style-image property with an ordered list selector (UL) to change the list-item bullet to an image of your choice.

Property Value
Display Inline, block, listitem
Line-height Measurement or %
List-style-type Disc, circle, square, decimal, lower-roman, upper-roman, lower-alpha, upper-alpha, none
List-style-image Url (http://www.layoutgalaxy.com)

Syntax

To Set square as the bullet style
<STYLE>
<! -
UL LI {list-style-type: square}
-- >
</STYLE>

To set a image as bullet style
<STYLE>
<! -
UL LI {list-style-image: url (figure.gif)}
-- >
</STYLE>

Back Next


Copyrights : Layout Galaxy All Rights Reserved
No part of this tutorial may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, mechanical or otherwise, without prior permission in writing from Layout Galaxy.




17, Vadsarvala Nivas, 65-A, J. Nehru Road, Mulund (W), Mumbai - 400 080 INDIA
Tel : 91-22-25795588, 91-22-25780444 Fax : 91-22-25793397
Email : ionline@vsnl.com
© Image Online 2001-2003