home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Platinum Edition Using HTML 4, XML, and Java 1.2
(Publisher: Macmillan Computer Publishing)
Author(s): Eric Ladd
ISBN: 078971759x
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


To get started, it is helpful to recall some of the style-related code—both CSS and JavaScript—that you saw earlier in the chapter. Go back a few pages and look at Listing 25.1. Both techniques apply the same style information, yet one is an implementation of CSS style sheets and the other is an implementation of JavaScript Accessible Style Sheets. If you are familiar with one approach, you can see that it would be pretty easy to learn the other. Most of the style characteristics you can set have the same name (although the names differ in the use of hyphens, capitalization, and so on). The chief difference between the two approaches is how the style characteristics are assigned. The CSS approach uses name/value pairs separated by a colon. The JavaScript approach is more object based in that you reference an object’s (a tag’s) style property and set it to the value you want. Beyond the syntactical difference in assigning values, the two approaches are—in most respects—equivalent.

Table 25.1 summarizes the style characteristics you can assign by either approach and includes the keyword for the characteristic that you would use in either the CSS or JavaScript approach. The table should make a handy reference for all style sheet authors, regardless of how they are assigning style information.

Table 25.1 Style Characteristics in CSS and JavaScript Accessible Style Sheets

Style Characteristic CSS Keyword JavaScript Property

font family font-family fontFamily
font size font-size fontSize
font style font-style fontStyle
font weight font-weight fontWeight
text alignment text-align textAlign
text decoration text-decoration textDecoration
text indent text-indent textIndent
text transform text-transform textTransform
line height line-height lineHeight
alignment float align
border color border-color borderColor
border style border-style borderStyle
border widths (all) border-width borderWidths()
border width (bottom) border-bottom-width borderBottomWidth
border width (left) border-left-width borderLeftWidth
border width (right) border-right-width borderRightWidth
border width (top) border-top-width borderTopWidth
margins (all) margin margins()
margin (bottom) margin-bottom marginBottom
margin (left) margin-left marginLeft
margin (right) margin-right marginRight
margin (top) margin-top marginTop
padding (all) paddings paddings()
padding (bottom) padding-bottom paddingBottom
padding (left) padding-left paddingLeft
padding (right) padding-right paddingRight
padding (top) padding-top paddingTop
width width width
background color background-color backgroundColor
background image background-image backgroundImage
color color color
display display display
list style type list-style-type listStyleType
whitespace white-space whiteSpace

You are probably familiar with most of the characteristics in Table 25.1, except possibly for the last three. Display controls how an element is displayed and can take values of block (display as a block-level element), inline, list-item, or none. List style type refers to the different styles of ordered and unordered lists HTML supports. You may set the list-style-type keyword or the listStyleType property to values of disc, circle, square, decimal, lower-alpha, upper-alpha, lower-roman, upper-roman, or none. Finally, the whitespace characteristic specifies how extra whitespace should be treated. A whitespace value of normal means that extra whitespace characters will be ignored, and a value of pre means that all whitespace characters will be rendered.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.