Lesson-6 (DHTML and Stylesheets)

An HTML document can be viewed as a container having several objects like paragraphs,images,tables,lists etc. this method of desinging is called Document Object Model(DOM).IN DOM,each object of a document can have properties assiciated with it.It is also possible for some objects to have access to database or any scripiting languages such as VB Script,Java Script,etc.Such facilities are provided by Dynamic HTML (DHTML).IT is beyond the scope of this book to completely discus the features of Dynamic HTML.However , we will briefly discus the features of Dynamic HTML,and study style sheets throughly in this chapter.
Dynamic HTML has the following features.

  6.1 Defining Styles

A statment of the following format defines a style.
item{property:value}

For example,consider the following.

H1{font:"Times Romen"bold 24pt;color:red}

This statment tells us that all the h1 type headings must apper in Times Roman font,24 point size, bold and in red color.

Consider the following.

A{color:red;text-decoration:bliking}

This informs the browser that all the hypertexts with anchores must apperes in red color,and they must also be blinking.

Suppose we want any pragraph text to apper in Arial font,in 12-pointsize with a text indent of 0.5 inches. We can give the following statment in the style sheet.
body{margin-left:1.5in margin-right:1.5in}

Now let us see each element of the styles in detail.

  6.2 Elements of Styles

Styles usually define the following:

  6.2.1 Font Assignments

When a font is to be assigned, we define it as shown in the following example.
    font:"Times Roman"14pt bold;

We can also define it as follows.
font-size:14pt;font-name:"Times Roman";font-weight:bold
The point size is defined as an integer followed by "pt".Instead of defining the absolute font size,we can also define it in a relative manner.For example, we can define font-size=+2pt.This tells us that the style assigned is 2 pts more than the normal font size. If the normal font size is 12 pts,then this will be assigned 14 pts.Similarly, if we define font-size=-3pt, this will reduse the normal font size by 3 pts.
It is also possible to define the font size using the key words shown in Table 6.1

Table
6.1-Key words for font sizes

Key wordMeaning
xx-smallDouble extermely small
x-smallExtermely small
smallsmall
mediumMedium
largeLarge
x-largeExtra large
xx-largeDouble extra large