Sunteți pe pagina 1din 44

IT0306 Web Systems and Technology- CSS Properties

Background Properties Property Description Possible Values fixed scroll Examples div { backgroundattachment:fixed; } div { backgroundattachment:scroll; }

background-attachment Declares the attachment of a background image (to scroll with the page content or be in a fixed position). background-color Declares the background color.

Valid color names, RGB values, hexidecimal notation. URL values.

div { backgroundcolor:green; } div { color:#00FF00; }

background-image

Declares the background image of an element. Declares the position of a background image.

div { backgroundimage:url(images/img.jpg); } body { backgroundimage:url(img.jpg); } div { backgroundposition:10px 50px; } div { backgroundposition:bottom right; }

background-position

Lengths or percentages for the x and y positions, or one of the predefined values: top left top center top right center left center center center right bottom left bottom center bottom right repeat repeat-x repeat-y no-repeat Separate values by a space in the following order (those that are not defined will use inherited or

background-repeat

Declares how and/or if a background image repeats. Used as a shorthand property to set all the background properties at

div { backgroundrepeat:repeat-x; } div { background-repeat:norepeat; } div { background:green url(image.jpg) no-repeat fixed center center; } div { background:url(image.jpg) fixed; }

background

Information Technology, Prepared by Subashini.N.J

Page 1

IT0306 Web Systems and Technology- CSS Properties


once. default initial values): backgroundcolor backgroundimage backgroundrepeat backgroundattachment backgroundposition

Border Properties Property border-top-color Description Declares the color of the top border. Possible Values Examples

Valid color names, RGB values, div { border-tophexidecimal notation, or the color:green; } predefined value transparent. div { border-topcolor:#00FF00; } none hidden dotted dashed solid double groove ridge inset outset Lengths or the following predefined values: thin medium thick Separate values by a space in the following order (those that are not defined will use inherited or default initial values): border-top-width border-top-style border-top-color div { border-topstyle:solid; } div { border-topstyle:inset; }

border-top-style

Declares the style of the top border.

border-top-width

Declares the width of the top border.

div { border-topwidth:2px; } div { border-topwidth:thin; } div { bordertop:2px solid green; } div { bordertop:thick double #00FF00; }

border-top

Used as a shorthand property to set all the bordertop properties at once.

border-right-color

Declares the color of the

Valid color names, RGB values, div { borderhexidecimal notation, or the right-

Information Technology, Prepared by Subashini.N.J

Page 2

IT0306 Web Systems and Technology- CSS Properties


right border. predefined value transparent. color:green; } div { borderrightcolor:#00FF00; } div { borderright-style:solid; } div { borderright-style:inset; }

border-right-style

Declares the style of the right border.

none hidden dotted dashed solid double groove ridge inset outset Lengths or the following predefined values: thin medium thick Separate values by a space in the following order (those that are not defined will use inherited or default initial values): border-right-width border-right-style border-right-color

border-right-width

Declares the width of the right border.

div { borderright-width:2px; } div { borderright-width:thin; } div { borderright:2px solid green; } div { borderright:thick double #00FF00; }

border-right

Used as a shorthand property to set all the borderright properties at once.

border-bottom-color

Declares the color of the bottom border.

Valid color names, RGB values, div { borderhexidecimal notation, or the bottompredefined value transparent. color:green; } div { borderbottomcolor:#00FF00; } none hidden dotted dashed solid double groove ridge inset div { borderbottomstyle:solid; } div { borderbottomstyle:inset; }

border-bottom-style

Declares the style of the bottom border.

Information Technology, Prepared by Subashini.N.J

Page 3

IT0306 Web Systems and Technology- CSS Properties


outset border-bottom-width Declares the width of the bottom border. Lengths or the following predefined values: thin medium thick Separate values by a space in the following order (those that are not defined will use inherited or default initial values): border-bottom-width border-bottom-style border-bottom-color div { borderbottomwidth:2px; } div { borderbottomwidth:thin; } div { borderbottom:2px solid green; } div { borderbottom:thick double #00FF00; }

border-bottom

Used as a shorthand property to set all the borderbottom properties at once. Declares the color of the left border.

border-left-color

Valid color names, RGB values, div { border-lefthexidecimal notation, or the color:green; } predefined value transparent. div { border-leftcolor:#00FF00; } none hidden dotted dashed solid double groove ridge inset outset Lengths or the following predefined values: thin medium thick Separate values by a space in the following order (those that are not defined will use inherited or default initial values): border-left-width border-left-style border-left-color div { border-leftstyle:solid; } div { border-leftstyle:inset; }

border-left-style

Declares the style of the left border.

border-left-width

Declares the width of the left border.

div { border-leftwidth:2px; } div { border-leftwidth:thin; } div { borderleft:2px solid green; } div { borderleft:thick double #00FF00; }

border-left

Used as a shorthand property to set all the borderleft properties at once.

border-color

Declares the

Valid color names, RGB values, div { borderPage 4

Information Technology, Prepared by Subashini.N.J

IT0306 Web Systems and Technology- CSS Properties


border color of all four borders at once. hexidecimal notation, or the predefined value transparent. Separate the color for each border by a space, declaring the colors for the borders in the following order: border-top-color border-right-color border-bottom-color border-left-color Undeclared values work as further shorthand notation. If only one color value is declared, all four borders will use that color. If two colors are declared, the top and bottom borders will use the first color while the right and left borders will use the second color. If three colors are declared, the top border will use the first color, the right and left borders will use the second color, and the bottom border will use the third color. none hidden dotted dashed solid double groove ridge inset outset Undeclared values work as further shorthand notation. If only one style value is declared, all four borders will use that style. If two styles are declared, the top and bottom borders will use the first style while the right and left borders will use the second style. If three styles are declared, the top border will use the first style, the right and left borders will use the second style, and the bottom border color:green red blue olive; } div { bordercolor:green; } div { bordercolor:green red; } div { bordercolor:green red blue; }

border-style

Declares the border style of all four borders at once.

div { borderstyle:solid dotted dashed double; } div { borderstyle:solid; } div { borderstyle:solid dotted; } div { borderstyle:solid dotted dashed; }

Information Technology, Prepared by Subashini.N.J

Page 5

IT0306 Web Systems and Technology- CSS Properties


will use the third style. border-width Declares the Lengths or the following width of all four predefined values: borders at once. thin medium thick Undeclared values work as further shorthand notation. If only one width value is declared, all four borders will use that width. If two widths are declared, the top and bottom borders will use the first width while the right and left borders will use the second width. If three widths are declared, the top border will use the first width, the right and left borders will use the second width, and the bottom border will use the third width. Used as a shorthand to declare the border properties when all four borders will have the same appearance. Separate values by a space in the following order (those that are not defined will use inherited or default initial values): border-width border-style border-color div { borderwidth:1px 3px 5px 2px; } div { borderwidth:thin; } div { borderwidth:2px 4px; } div { borderwidth:2px 4px 5px; }

border

div { border:1px double green; } div { border:thin solid #00FF00; }

Classification and Positioning Properties Property clear Description Declares the side(s) of an element where no previous floating elements are allowed to be adjacent. Declares the type of cursor to be displayed. Possible Values left right both none URL values, and the following prefefined values: auto crosshair default pointer move e-resize Examples div { clear:right; } div { clear:both; }

cursor

div { cursor:crosshair; } div { cusrsor:url(image.csr); } div { cusrsor:url(image.csr), pointer; }

Information Technology, Prepared by Subashini.N.J

Page 6

IT0306 Web Systems and Technology- CSS Properties


ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize text wait help display Declares if/how the element displays. none inline block list-item run-in compact marker table inline-table table-row-group table-headergroup table-footergroup table-row table-columngroup table-column table-cell table-caption div { display:none; } div { display:inline; } div { display:marker; }

float

Declares whether a box should left float to the left or right of other right content, or whether it should none not be floated at all. Declares the visibility of boxes generated by an element. Declares the distance that the top content edge of the element is offset below the top edge of its containing block. Theposition property of the element must also be set to a value other than static. Declares the distance that the visible hidden collapse Lengths, percentages, and the predefined value auto.

div { float:left; } div { float:right; }

visibility

div { visibility:visible; } div { visibility:hidden; } div { top:15px; } div { top:2%; }

top

right

Lengths,

div { right:15px; }

Information Technology, Prepared by Subashini.N.J

Page 7

IT0306 Web Systems and Technology- CSS Properties


right content edge of the element is offset to the left of the right edge of its containing block. The position property of the element must also be set to a value other than static. bottom Declares the distance that the bottom content edge of the element is offset above the bottom edge of its containing block. The position property of the element must also be set to a value other than static. Declares the distance that the left content edge of the element is offset to the right of the left edge of its containing block. Theposition property of the element must also be set to a value other than static. Declares the type of positioning of an element. percentages, and the predefined value auto. div { right:2%; }

Lengths, percentages, and the predefined value auto.

div { bottom:15px; } div { bottom:2%; }

left

Lengths, percentages, and the predefined value auto.

div { left:15px; } div { left:2%; }

position

static relative absolute fixed Shapes, or the predefined value auto. In CSS 2, the only valid shape is a rectangle, using the following format to specify the offset lengths from each side of the box: rect(top, right, bottom, left) visible hidden scroll auto

div { position:absolute; } div { position:relative; } div { clip:auto; } div { clip:rect(2px, 4px, 7px, 5px); }

clip

Declares the shape of a clipped region when the value of the overflow property is set to a value other than visible.

overflow

Declares how content that overflows the element's box is handled.

div { overflow:hidden; } div { overflow:scroll; }

vertical-align Declares the vertical alignment Lengths, of an inline-level element or a percentages, and table cell. the following
Information Technology, Prepared by Subashini.N.J

span { verticalalign:middle; } td { vertical-align:top; }


Page 8

IT0306 Web Systems and Technology- CSS Properties


predefined values: baseline sub super top text-top middle bottom text-bottom z-index Declares the stack order of the element. Integer values and the predefined value auto. div { z-index:2; } div { z-index:auto; }

Dimension Properties Property height Description Declares the height of the element. Possible Values Lengths, percentages, and the predefined value auto. Examples div { height:200px; } div { height:50%; } div { maxheight:200px; } div { maxheight:50%; } div { minheight:200px; } div { minheight:50%; } div { width:500px; } div { width:75%; } div { maxwidth:500px; } div { maxwidth:75%; } div { minwidth:500px; } div { minwidth:75%; }

max-height Declares the maximum height of the element.

Lengths, percentages, and the predefined value auto.

min-height

Declares the minimum height of the element.

Lengths, percentages, and the predefined value auto.

width

Declares the width of the element. Declares the maximum width of the element.

Lengths, percentages, and the predefined value auto. Lengths, percentages, and the predefined value auto.

max-width

min-width

Declares the minimum width of the element.

Lengths, percentages, and the predefined value auto.

Font Properties Property Description Possible Values Examples

Information Technology, Prepared by Subashini.N.J

Page 9

IT0306 Web Systems and Technology- CSS Properties


font-family Declares the name of the font to be used. Previously set in HTML via the faceattribute in a <font> tag. Valid font family names or generic family names, i.e. Arial, Verdana, sansserif, "Times New Roman", Times, serif, etc. Font family names can be separated by a comma in the same declaration to allow additional and/or generic family names to be used if the prefereed font is unable to be displayed. Lengths (number and unit type i.e. 1em,12pt, 10px, 80%) or one of the following predefined values: xx-small x-small small medium large x-large xx-large smaller larger Numeric value div { fontfamily:Arial; } div { fontfamily:Arial, Helvetica, sansserif; }

font-size

Declares the size of the font. Previously set in HTML via the size attribute in a <font> tag.

div { fontsize:70%; } div { fontsize:0.85em; } div { fontsize:medium; }

font-size-adjust Limited browser support: Was part of CSS 2, but not in CSS 2.1. This property may return in CSS 3. Declares the aspect value(font size divided by xheight). font-stretch Limited browser support: Was part of CSS 2, but not in CSS 2.1. This property may return in CSS 3. Declares the stretch of the font face.

div { font-sizeadjust:0.54; } div { font-sizeadjust:0.46; }

normal wider narrower ultra-condensed extra-condensed condensed semi-condensed semi-expanded expanded extra-expanded ultra-expanded

div { fontstretch:narrower; } div { fontstretch:ultraexpanded; }

Information Technology, Prepared by Subashini.N.J

Page 10

IT0306 Web Systems and Technology- CSS Properties


font-style Declares the font style. normal italic oblique normal small-caps div { fontstyle:italic; } div { fontstyle:oblique; } div { fontvariant:normal; } div { fontvariant:smallcaps; } div { fontweight:bolder; } div { fontweight:200; }

font-variant

Declares the font variant.

font-weight

Declares the font weight (lightness or boldness)

normal bold bolder lighter 100 200 300 400 500 600 700 800 900 Separate values by a space in the following order (those that are not defined will use inherited or default initial values): font-style font-variant font-weight font-size line-height font-family

font

Used as a shorthand property to declare all of the font properties at once (except font-sizeadjust and fontstretch).

div { font:italic small-caps bold 1em 1.2em Arial } div { font:bold 0.8em Verdana }

Generated Content Properties Property content Description Generates content in the document in conjunction with the :before and:after pseudo -elements. Possible Values String values, URL values, and predefined value formats: counter(name) counter(name, list-style-type) counters(name , string) Examples div:before { content:"some text"; } div:after { content:url(page2.html) ;}

Information Technology, Prepared by Subashini.N.J

Page 11

IT0306 Web Systems and Technology- CSS Properties


counters(name , string, liststyle-type) attr(X) open-quote close-quote no-open-quote no-close-quote counterincrement counter-reset Declares the counter increment for each instance of a selector. Declares the value the counter is set to on each instance of a selector. Declares the type of quotation marks to use for quotations and embedded quotations. Integers and the predefined value none. Integers and the predefined value none. String values and the predefined value none.

quotes

List Properties Property list-style-type Description Declares the type of list marker used. Possible Values disc circle square decimal decimal-leadingzero lower-roman upper-roman lower-alpha upper-alpha lower-greek lower-latin upper-latin hebrew armenian georgian cjk-ideographic hiragana katakana hiragana-iroha katakana-iroha inside outside Examples ol { list-styletype:upper-roman; } ul { list-styletype:square; }

list-style-position Declares the position of the list marker.

ol { list-styleposition:inside; } ul { list-style-

Information Technology, Prepared by Subashini.N.J

Page 12

IT0306 Web Systems and Technology- CSS Properties


position:outside; } list-style-image list-style Declares an image to be used as the list marker. Shorthand property to declare three list properties at once. URL values. Separate values by a space in the following order (those that are not defined will use inherited or default initial values): list-style-type list-style-position list-style-image ul { list-styleimage:url(image.jpg); } ul { list-style:disc inside url(image.gif); } ol { list-style:upperroman outside; }

marker-offset

Declares the marker Lengths and the offset for elements with a predefined value ofmarker set for valueauto. the displayproperty.

li:before { display:marker; marker-offset:5px; }

Margin Properties Property margin-top Description Declares the top margin for the element. Declares the right margin for the element. Possible Values Lengths, percentages, and the predefined value auto. Examples div { margintop:5px; } div { margintop:15%; } div { marginright:5px; } div { marginright:15%; } div { marginbottom:5px; } div { marginbottom:15%; } div { marginleft:5px; } div { marginleft:15%; } div { margin:5px 12px 4px 7px; } div { margin:5px; } div {
Page 13

margin-right

Lengths, percentages, and the predefined value auto.

margin-bottom Declares the bottom margin for the element. margin-left Declares the left margin for the element. Shorthand property used to declare all the margin properties at once.

Lengths, percentages, and the predefined value auto.

Lengths, percentages, and the predefined value auto.

margin

Separate values by a space in the following order (those that are not defined will use inherited or default initial values): margin-top margin-right margin-bottom

Information Technology, Prepared by Subashini.N.J

IT0306 Web Systems and Technology- CSS Properties


margin-left Undeclared values work as further shorthand notation. If only one length value is declared, all four margins will use that length. If two lengths are declared, the top and bottom margins will use the first length while the right and left margins will use the second length. If three lengths are declared, the top margin will use the first length, the right and left margins will use the second length, and the bottom margin will use the third length. Outline Properties Property outline-color Description Declares the outline color. Possible Values Valid color names, RGB values, hexidecimal notation. Examples div { outlinecolor:green; } div { outlinecolor:#00FF00; } div { outlinestyle:solid; } div { outlinestyle:inset; } margin:5px 10px; } div { margin:5px 7px 4px; }

outline-style

Declares the style of the outline.

none dotted dashed solid double groove ridge inset outset Lengths or the following predefined values: thin medium thick Separate values by a space in the following order (those that are not defined will use inherited or default initial values): outline-color outline-style outline-width

outline-width Declares the width of the outline.

div { outlinewidth:2px; } div { outlinewidth:thin; } div { outline:green solid 2px; } div { outline:#00FF00 double thick; }

outline

Used as a shorthand property to set all the background properties at once.

Padding Properties Property Description Possible Values Examples

Information Technology, Prepared by Subashini.N.J

Page 14

IT0306 Web Systems and Technology- CSS Properties


padding-top Declares the top padding for the element. Lengths, percentages, and the predefined value auto. div { paddingtop:5px; } div { paddingtop:15%; } div { paddingright:5px; } div { paddingright:15%; } div { paddingbottom:5px; } div { paddingbottom:15%; } div { paddingleft:5px; } div { paddingleft:15%; } div { padding:5px 12px 4px 7px; } div { padding:5px; } div { padding:5px 10px; } div { padding:5px 7px 4px; }

padding-right

Declares the Lengths, percentages, and the right padding for predefined value auto. the element. Lengths, percentages, and the predefined value auto.

padding-bottom Declares the bottom padding for the element. padding-left Declares the left padding for the element. Shorthand property used to declare all the margin properties at once.

Lengths, percentages, and the predefined value auto.

padding

Separate values by a space in the following order (those that are not defined will use inherited or default initial values): padding-top padding-right padding-bottom padding-left Undeclared values work as further shorthand notation. If only one length value is declared, all four sides will use that length. If two lengths are declared, the top and bottom sides will use the first length while the right and left sides will use the second length. If three lengths are declared, the top side will use the first length, the right and left sides will use the second length, and the bottom side will use the third length.

Page Properties Property marks orphans Description Declares the type of marks to display outside the page box. Declares the minimum number of lines of a paragraph that must be left at the bottom of a page. Possible Values crop cross Integers Examples @page { marks:crop; } @page { orphans:2; }

Information Technology, Prepared by Subashini.N.J

Page 15

IT0306 Web Systems and Technology- CSS Properties


page page-break-after Declares the type of page where an element should be displayed. Declares a page break. Indentifiers auto always avoid left right auto always avoid left right auto avoid Lengths, and the following predefined values: auto landscape potrait Integers @page { widows:2; }

page-break-before Declares a page break.

page-break-inside size

Declares a page break. Declares the size and orientation of a page box.

widows

Declares the minimum number of lines of a paragraph that must be left at the top of a page.

Table Properties Property Description Possible Values Examples table { bordercollapse:collapse; } table { bordercollapse:separate; } table { borderspacing:5px; } table { borderspacing:5px 10px; }

border-collapse Declares the way borders collapse are displayed. separate

border-spacing

Declares the distance separating borders (if bordercollapse isseparate).

Lengths for the horizontal and vertical spacing, separated by a space. If one length is value is declared, that length is used for both the horizontal and vertical spacing. If two lengths are declared, the first one is used for horizontal spacing and the second one is used for vertical

Information Technology, Prepared by Subashini.N.J

Page 16

IT0306 Web Systems and Technology- CSS Properties


spacing. caption-side Declares where the table caption is displayed in relation to the table. Declares the way empty cells are displayed (ifbordercollapseis separate). top bottom left right show hide caption { captionside:top; } caption { captionside:right; } table { emptycells:show; } table { emptycells:hide; } table { tablelayout:auto; } table { tablelayout:fixed; }

empty-cells

table-layout

Declares the type of table auto layout. fixed

Text Properties Property color Description Possible Values Examples div { color:green; } div {color:rgb(0,255,0); } div { color:#00FF00; }

Declares the color of the Valid color names, RGB text. values, hexidecimal notation. The predefined color names are: aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal white yellow Declares the reading direction of the text. ltr rtl ltr = left-to-right rtl = right-to-left Numbers, percentages, lengths, and the predefined value of normal.

direction

div { direction:ltr; } div { direction:rtl; }

line-height

Declares the distance between lines.

div { lineheight:normal; } div { line-height:2em; }


Page 17

Information Technology, Prepared by Subashini.N.J

IT0306 Web Systems and Technology- CSS Properties


div { lineheight:125%; } letter-spacing Declares the amount of space between text characters. A length (in addition to the default space) or the predefined value ofnormal. div { letterspacing:normal; } div { letterspacing:5px; } div { letter-spacing:1px; } div { textalign:center; } div { text-align:right; } td { text-align:"."; }

text-align

Declares the horizontal alignment of inline content.

left right center justify If used on a set of table cells, this property can be given a string value to which the text of each row of the column will be aligned. none underline overline line-through blink Lengths and percentages. A list containg a color followed by numeric values (separated by spaces) that specify: 1. The color for the shadow effect 2. Horizontal distance to the right of the text 3. Vertical distance below the text 4. Blur radius none capitalize uppercase lowercase

text-decoration Declares the text decoration.

div { textdecoration:none; } div { textdecoration:underline; } div { text-indent:12px; } div { text-indent:2%; } div { textshadow:green 2px 2px 7px; } div { textshadow:olive -3px 4px 5px; }

text-indent

Declares the indentation of the first line of text. Declares shadow effects on the text.

text-shadow

text-transform

Declares the capitalization effects on the letters in the text.

div { texttransform:uppercase; } div { texttransform:lowercase; }

Information Technology, Prepared by Subashini.N.J

Page 18

IT0306 Web Systems and Technology- CSS Properties


unicode-bidi Declares values relating to bidirectional text. May be used in conjunction with the the direction property. Declares how white space is handled in an element. Declares the space between words in the text. normal embed bidi-override div { unicodebidi:embed; } div { unicodebidi:bidi-override; } div { white-space:pre; } div { whitespace:nowrap; } div { wordspacing:normal; } div { wordspacing:1.5em; }

white-space

normal pre nowrap A length (in addition to the default space) or the predefined value ofnormal.

word-spacing

Other Properties Property azimuth Description Declares the angle that sound travels to the listener. Possible Values Examples

Angle values in degrees div { azimuth:90deg; } (deg), or one of the div { azimuth:behind; } following predefined values: left-side far-left left center-left center center-right right far-right right-side behind leftwards rightwards URL values and the predefined valuenone. URL values and the predefined valuenone. URL values and the predefined valuenone. Separate the values by a space in the following order: cue-before cue-after div { cueafter:url(sound.wav); } div { cue-after:none; } div { cuebefore:url(sound.wav); } div { cue-before:none; } div { cue:url(sound.wav) url(sound2.wav); } div { cue:url(sound.wav); }

cue-after

Declares an audio cue to play after an element. Declares an audio cue to play before an element. Shorthand proerty to set both cue values at once.

cue-before

cue

Information Technology, Prepared by Subashini.N.J

Page 19

IT0306 Web Systems and Technology- CSS Properties


If only one cue value is declared, it is used for both before and after. elevation Declares the elevation of a sound. Angle values in degrees div { elevation:30deg; } (deg), or one of the div { elevation:higher; } following predefined values: below level above higher lower Time in milliseconds (ms) or percentages. div { pause-after:100ms; } div { pause-after:20%; } div { pausebefore:100ms; } div { pause-before:20%; }

pause-after

Declares the amount of time to pause after an element. Declares the amount of time to pause before an element. Shorthand proerty to set both pause values at once.

pause-before

Time in milliseconds (ms) or percentages.

pause

Separate the values by div { pause:200ms a space in the following 100ms; } div { pause:100ms; } order: pause-before pause-after If only one pause value is declared, it is used for both before and after. Frequencies in hertz (Hz) or the following predefined values: x-low low medium high x-high div { pitch:120Hz; } div { pitch:high; }

pitch

Declares the average speaking pitch of a voice.

pitch-range

Declares a change in the pitch range of a voice.

Number values div { pitch-range:50; } between 0 and 100 div { pitch-range:99; } (lower values indicate a flat voice while higher values indicate an animated voice). URL value, followed div { playPage 20

play-during

Declares a

Information Technology, Prepared by Subashini.N.J

IT0306 Web Systems and Technology- CSS Properties


background sound to be played while the current element is spoken. by one or more of the following keywords, separated by spaces: mix repeat Alternatley, one of the following keywords: auto none Numeric values between 0 and 100 (lower values have less richness and higher values have more richness). normal none spell-out during:url(music.wav); } div { playduring:url(music.wav) repeat; } div { play-during:none; }

richness

Declares the richness of the voice in spoken text.

div { richness:50; } div { richness:0; }

speak

Declares if/how text is spoken.

div { speak:none; } div { speak:spell-out; } th { speak-header:once; } th { speakheader:always; } div { speaknumeral:digits; } div { speaknumeral:continuous; } div { speakpunctuation:code; } div { speakpunctuation:none; } div { speech-rate:50; } div { speechrate:medium; }

speak-header

Declares how often once table header cells always are spoken. Declares how numerals are spoken. digits continuous

speak-numeral

speak-punctuation Declares how punctuation is spoken. speech-rate Declares the speech rate of spoken text.

code none

A number indicating the number of words per minute, or one of the following predefined values: x-slow slow medium fast x-fast faster slower Numeric values between 0 and 100

stress

Declares the stress of the voice on

div { stress:50; } div { stress:0; }


Page 21

Information Technology, Prepared by Subashini.N.J

IT0306 Web Systems and Technology- CSS Properties


spoken text. (lower values have less stress and higher values have more stress). Generic or specific voice family names. Numbers between 0 and 100, percentages, or one of the following predefined values: silent x-soft soft medium loud x-loud div { volume:50; } div { volume:silent; }

voice-family

Declares the voice family of spoken text. Declares the median volume.

volume

Syntax Used in Property Definitions <Foo> Value of type Foo. Common types are discussed in the Units section. Foo A keyword that must appear literally (though without case sensitivity). Commas and slashes must also appear literally. ABC A must occur, then B, then C, in that order. A|B A or B must occur. A || B A or B or both must occur, in any order. [ Foo ] Brackets are used to group items together. Foo* Foo is repeated zero or more times. Foo+ Foo is repeated one or more times. Foo? Foo is optional. Foo{A,B} Foo must occur at least A times and at most B times. Font Properties Font Family Font Style Font Variant Font Weight Font Size Font
Information Technology, Prepared by Subashini.N.J Page 22

IT0306 Web Systems and Technology- CSS Properties


Font Family Syntax: font-family: [[<family-name> | <generic-family>],]* [<family-name> | <generic-family>] Possible Values: <family-name> Any font family name may be used <generic-family> serif (e.g., Times) sans-serif (e.g., Arial or Helvetica) cursive (e.g., Zapf-Chancery) fantasy (e.g., Western) monospace (e.g., Courier) Initial Value: Determined by browser Applies to: All elements Inherited: Yes Font families may be assigned by a specific font name or a generic font family. Obviously, defining a specific font will not be as likely to match as a generic font family. Multiple family assignments can be made, and if a specific font assignment is made it should be followed by a generic family name in case the first choice is not present. A sample font-family declaration might look like this: P { font-family: "New Century Schoolbook", Times, serif } Notice that the first two assignments are specific type faces: New Century Schoolbook and Times. However, since both of them are serif fonts, the generic font family is listed as a backup in case the system does not have either of these but has another serif font which meets the qualifications. Any font name containing whitespace must be quoted, with either single or double quotes. The font family may also be given with the font property. Font Style Syntax: font-style: <value> Possible Values: normal | italic | oblique Initial Value: normal Applies to: All elements Inherited: Yes The font-style property defines that the font be displayed in one of three ways: normal, italic or oblique (slanted). A sample style sheet with font-style declarations might look like this: H1 { font-style: oblique } P { font-style: normal } Font Variant Syntax: font-variant: <value> Possible Values: normal | small-caps Initial Value: normal Applies to: All elements Inherited: Yes The font-variant property determines if the font is to display in normal or small-caps. Smallcaps are displayed when all the letters of the word are in capitals with uppercase characters slightly larger than lowercase. Later versions of CSS may support additional variants such as

Information Technology, Prepared by Subashini.N.J

Page 23

IT0306 Web Systems and Technology- CSS Properties


condensed, expanded, small-caps numerals or other custom variants. An example of a fontvariant assignment would be: SPAN { font-variant: small-caps } Font Weight Syntax: font-weight: <value> Possible Values: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 Initial Value: normal Applies to: All elements Inherited: Yes The font-weight property is used to specify the weight of the font. The bolder and lighter values are relative to the inherited font weight, while the other values are absolute font weights. Note: Since not all fonts have nine possible display weights some of the weights may be grouped together in assignment. If the specified weight is not available, an alternate will be chosen on the following basis: 500 may be switched with 400, and vice versa 100-300 may be assigned to the next lighter weight, if any, or the next darker weight otherwise 600-900 may be assigned to the next darker weight, if any, or the next lighter weight otherwise Some example font-weight assignments would be: H1 { font-weight: 800 } P { font-weight: normal } Font Size Syntax: font-size: <absolute-size> | <relative-size> | <length> | <percentage> Possible Values: <absolute-size> xx-small | x-small | small | medium | large | x-large | xx-large <relative-size> larger | smaller <length> <percentage> (in relation to parent element) Initial Value: medium Applies to: All elements Inherited: Yes The font-size property is used to modify the size of the displayed font. Absolute lengths (using units like pt and in) should be used sparingly due to their weakness in adapting to different browsing environments. Fonts with absolute lengths can very easily be too small or too large for a user. Some example size assignments would be: H1 { font-size: large } P { font-size: 12pt } LI { font-size: 90% } STRONG { font-size: larger } Authors should be aware that Microsoft Internet Explorer 3.x incorrectly treats em and ex units as pixels, which can easily make text using these units unreadable. The browser also

Information Technology, Prepared by Subashini.N.J

Page 24

IT0306 Web Systems and Technology- CSS Properties


incorrectly applies percentage values relative to its default font size for the selector, rather than relative to the parent element's font size. This makes rules like H1 { font-size: 200% } dangerous in that the size will be twice IE's default font size for level-one headings, rather than twice the parent element's font size. In this case, BODY would most likely be the parent element, and it would likely define a medium font size, whereas the default level-one heading font size imposed by IE would probably be considered xx-large. Given these bugs, authors should take care in using percentage values for font-size, and should probably avoid em and ex units for this property. Font Syntax: font: <value> Possible Values: [ <font-style> || <font-variant> || <font-weight> ]? <font-size> [ / <line-height> ]? <font-family> Initial Value: Not defined Applies to: All elements Inherited: Yes The font property may be used as a shorthand for the various font properties, as well as the line height. For example, P { font: italic bold 12pt/14pt Times, serif } specifies paragraphs with a bold and italic Times or serif font with a size of 12 points and a line height of 14 points. Color and Background Properties Color Background Color Background Image Background Repeat Background Attachment Background Position Background Color Syntax: color: <color> Initial Value: Determined by browser Applies to: All elements Inherited: Yes The color property allows authors to specify the color of an element. See the Units section for color value descriptions. Some example color rules include: H1 { color: blue } H2 { color: #000080 } H3 { color: #0c0 } To help avoid conflicts with user style sheets, background and color properties should always be specified together. Background Color Syntax: background-color: <value>
Page 25

Information Technology, Prepared by Subashini.N.J

IT0306 Web Systems and Technology- CSS Properties


Possible Values: <color> | transparent Initial Value: transparent Applies to: All elements Inherited: No The background-color property sets the background color of an element. For example: BODY { background-color: white } H1 { background-color: #000080 } To help avoid conflicts with user style sheets, background-image should be specified whenever background-color is used. In most cases, background-image: none is suitable. Authors may also use the shorthand background property, which is currently better supported than the background-color property. Background Image Syntax: background-image: <value> Possible Values: <url> | none Initial Value: none Applies to: All elements Inherited: No The background-image property sets the background image of an element. For example: BODY { background-image: url(/images/foo.gif) } P { background-image: url(http://www.htmlhelp.com/bg.png) } When a background image is defined, a similar background color should also be defined for those not loading images. Authors may also use the shorthand background property, which is currently better supported than the background-image property. Background Repeat Syntax: background-repeat: <value> Possible Values: repeat | repeat-x | repeat-y | no-repeat Initial Value: repeat Applies to: All elements Inherited: No The background-repeat property determines how a specified background image is repeated. The repeat-x value will repeat the image horizontally while the repeat-y value will repeat the image vertically. For example: BODY { background: white url(candybar.gif); background-repeat: repeat-x } In the above example, the image will only be tiled horizontally. Authors may also use the shorthand background property, which is currently better supported than the background-repeat property. Background Attachment
Information Technology, Prepared by Subashini.N.J Page 26

IT0306 Web Systems and Technology- CSS Properties


Syntax: background-attachment: <value> Possible Values: scroll | fixed Initial Value: scroll Applies to: All elements Inherited: No The background-attachment property determines if a specified background image will scroll with the content or be fixed with regard to the canvas. For example, the following specifies a fixed background image: BODY { background: white url(candybar.gif); background-attachment: fixed } Authors may also use the shorthand background property, which is currently better supported than the background-attachment property. Background Position Syntax: background-position: <value> Possible Values: [<percentage> | <length>]{1,2} | [top | center | bottom] || [left | center | right] Initial Value: 0% 0% Applies to: Block-level and replaced elements Inherited: No 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. (A replaced element is one for which only the intrinsic dimensions are known; HTML replaced elements include IMG, INPUT, TEXTAREA, SELECT, and OBJECT.) The easiest way to assign a background position is with keywords: Horizontal keywords (left, center, right) Vertical keywords (top, center, bottom) Percentages and lengths may also be used to assign the position of the background image. Percentages are relative to the size of the element. Although lengths are allowed, they are not recommended due to their inherent weakness in dealing with differing display resolutions. When using percentages or lengths, the horizontal position is specified first, followed by the vertical position. A value such as 20% 65% specifies that the point 20% across and 65% down the image be placed at the point 20% across and 65% down the element. A value such as 5px 10px specifies that the upper left corner of the image be placed 5 pixels to the right of and 10 pixels below the upper left corner of the element. If only the horizontal value is given, the vertical position will be 50%. Combinations of lengths and percentages are allowed, as are negative positions. For example, 10% -2cm is permitted. However, percentages and lengths cannot be combined with keywords. The keywords are interpreted as follows: top left = left top = 0% 0% top = top center = center top = 50% 0%
Information Technology, Prepared by Subashini.N.J Page 27

IT0306 Web Systems and Technology- CSS Properties


right top = top right = 100% 0% left = left center = center left = 0% 50% center = center center = 50% 50% right = right center = center right = 100% 50% bottom left = left bottom = 0% 100% bottom = bottom center = center bottom = 50% 100% bottom right = right bottom = 100% 100% If the background image is fixed with regard to the canvas, the image is placed relative to the canvas instead of the element. Authors may also use the shorthand background property, which is currently better supported than the background-position property. Background Syntax: background: <value> Possible Values: <background-color> || <background-image> || <background-repeat> || <background-attachment> || <background-position> Initial Value: Not defined Applies to: All elements Inherited: No The background property is a shorthand for the more specific background-related properties. Some examples of background declarations follow: 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 } A value not specified will receive its initial value. For example, in the first three rules above, the background-position property will be set to 0% 0%. To help avoid conflicts with user style sheets, background and color properties should always be specified together. Text Properties Word Spacing Letter Spacing Text Decoration Vertical Alignment Text Transformation Text Alignment Text Indentation Line Height Word Spacing Syntax: word-spacing: <value> Possible Values: normal | <length> Initial Value: normal Applies to: All elements
Information Technology, Prepared by Subashini.N.J Page 28

IT0306 Web Systems and Technology- CSS Properties


Inherited: Yes The word-spacing property defines an additional amount of space between words. The value must be in the length format; negative values are permitted. Examples: P EM { word-spacing: 0.4em } P.note { word-spacing: -0.2em } Letter Spacing Syntax: letter-spacing: <value> Possible Values: normal | <length> Initial Value: normal Applies to: All elements Inherited: Yes The letter-spacing property defines an additional amount of space between characters. The value must be in the length format; negative values are permitted. A setting of 0 will prevent justification. Examples: H1 { letter-spacing: 0.1em } P.note { letter-spacing: -0.1em } Text Decoration Syntax: text-decoration: <value> Possible Values: none | [ underline || overline || line-through || blink ] Initial Value: none Applies to: All elements Inherited: No The text-decoration property allows text to be decorated through one of five properties: underline, overline, line-through, blink, or the default, none. For example, one can suggest that links not be underlined with A:link, A:visited, A:active { text-decoration: none } Vertical Alignment Syntax: vertical-align: <value> Possible Values: baseline | sub | super | top | text-top | middle | bottom | text-bottom | <percentage> Initial Value: baseline Applies to: Inline elements Inherited: No The vertical-align property may be used to alter the vertical positioning of an inline element, relative to its parent element or to the element's line. (An inline element is one which has no line break before and after it, for example, EM, A, and IMG in HTML.)

Information Technology, Prepared by Subashini.N.J

Page 29

IT0306 Web Systems and Technology- CSS Properties


The value may be a percentage relative to the element's line-height property, which would raise the element's baseline the specified amount above the parent's baseline. Negative values are permitted. The value may also be a keyword. The following keywords affect the positioning relative to the parent element: baseline (align baselines of element and parent) middle (align vertical midpoint of element with baseline plus half the x-height--the height of the letter "x"--of the parent) sub (subscript) super (superscript) text-top (align tops of element and parent's font) text-bottom (align bottoms of element and parent's font) The keywords affecting the positioning relative to the element's line are top (align top of element with tallest element on the line) bottom (align bottom of element with lowest element on the line) The vertical-align property is particularly useful for aligning images. Some examples follow: IMG.middle { vertical-align: middle } IMG { vertical-align: 50% } .exponent { vertical-align: super } Text Transformation Syntax: text-transform: <value> Possible Values: none | Capitalize | UPPERCASE | lowercase Initial Value: none Applies to: All elements Inherited: Yes The text-transform property allows text to be transformed by one of four properties: capitalize (capitalizes first character of each word) uppercase (capitalizes all characters of each word) lowercase (uses small letters for all characters of each word) none (the initial value) Examples: H1 { text-transform: uppercase } H2 { text-transform: capitalize } The text-transform property should only be used to express a stylistic desire. It would be inappropriate, for example, to use text-transform to capitalize a list of countries or names. Text Alignment Syntax: text-align: <value> Possible Values: left | right | center | justify Initial Value: Determined by browser Applies to: Block-level elements Inherited: Yes
Information Technology, Prepared by Subashini.N.J Page 30

IT0306 Web Systems and Technology- CSS Properties


The text-align property can be applied to block-level elements (P, H1, etc.) to give the alignment of the element's text. This property is similar in function to HTML's ALIGN attribute on paragraphs, headings, and divisions. Some examples follow: H1 { text-align: center } P.newspaper { text-align: justify } Text Indentation Syntax: text-indent: <value> Possible Values: <length> | <percentage> Initial Value: 0 Applies to: Block-level elements Inherited: Yes The text-indent property can be applied to block-level elements (P, H1, etc.) to define the amount of indentation that the first line of the element should receive. The value must be a length or a percentage; percentages refer to the parent element's width. A common use of text-indent would be to indent a paragraph: P { text-indent: 5em } Line Height Syntax: line-height: <value> Possible Values: normal | <number> | <length> | <percentage> Initial Value: normal Applies to: All elements Inherited: Yes The line-height property will accept a value to control the spacing between baselines of text. When the value is a number, the line height is calculated by multiplying the element's font size by the number. Percentage values are relative to the element's font size. Negative values are not permitted. Line height may also be given in the font property along with a font size. The line-height property could be used to double space text: P { line-height: 200% } Microsoft Internet Explorer 3.x incorrectly treats number values and values with em or ex units as pixel values. This bug can easily make pages unreadable, and so authors should avoid provoking it wherever possible; percentage units are often a good choice. Box Properties

Top Margin Right Margin Bottom Margin Left Margin Margin


Information Technology, Prepared by Subashini.N.J Page 31

IT0306 Web Systems and Technology- CSS Properties


Top Padding Right Padding Bottom Padding Left Padding Padding Top Border Width Right Border Width Bottom Border Width Left Border Width Border Width Border Color Border Style Top Border Right Border Bottom Border Left Border Border Width Height Float Clear Top Margin Syntax: margin-top: <value> Possible Values: <length> | <percentage> | auto Initial Value: 0 Applies to: All elements Inherited: No The margin-top property sets the top margin of an element by specifying a length or a percentage. Percentage values refer to the parent element's width. Negative margins are permitted. For example, the following rule would eliminate the top margin of a document: BODY { margin-top: 0 } Note that adjoining vertical margins are collapsed to use the maximum of the margin values. Right Margin Syntax: margin-right: <value> Possible Values: <length> | <percentage> | auto Initial Value: 0 Applies to: All elements Inherited: No The margin-right property sets the right margin of an element by specifying a length or a percentage. Percentage values refer to the parent element's width. Negative margins are permitted. Example:

Information Technology, Prepared by Subashini.N.J

Page 32

IT0306 Web Systems and Technology- CSS Properties


P.narrow { margin-right: 50% } Note that adjoining horizontal margins are not collapsed. Bottom Margin Syntax: margin-bottom: <value> Possible Values: <length> | <percentage> | auto Initial Value: 0 Applies to: All elements Inherited: No The margin-bottom property sets the bottom margin of an element by specifying a length or a percentage. Percentage values refer to the parent element's width. Negative margins are permitted. Example: DT { margin-bottom: 3em } Note that adjoining vertical margins are collapsed to use the maximum of the margin values. Left Margin Syntax: margin-left: <value> Possible Values: <length> | <percentage> | auto Initial Value: 0 Applies to: All elements Inherited: No The margin-left property sets the left margin of an element by specifying a length or a percentage. Percentage values refer to the parent element's width. Negative margins are permitted. Example: ADDRESS { margin-left: 50% } Note that adjoining horizontal margins are not collapsed. Margin Syntax: margin: <value> Possible Values: [ <length> | <percentage> | auto ]{1,4} Initial Value: Not defined Applies to: All elements Inherited: No The margin property sets the margins of an element by specifying between one and four values, where each value is a length, a percentage, or auto. Percentage values refer to the parent element's width. Negative margins are permitted. If four values are given, they apply to top, right, bottom, and left margin, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side.

Information Technology, Prepared by Subashini.N.J

Page 33

IT0306 Web Systems and Technology- CSS Properties


Examples of margin declarations include: BODY { margin: 5em } /* all margins 5em */ P { margin: 2em 4em } /* top and bottom margins 2em, left and right margins 4em */ DIV { margin: 1em 2em 3em 4em } /* top margin 1em, right margin 2em, bottom margin 3em, left margin 4em */ Note that adjoining vertical margins are collapsed to use the maximum of the margin values. Horizontal margins are not collapsed. Using the margin property allows one to set all margins; alternatively, the properties margintop, margin-bottom, margin-left, and margin-right may be used. Top Padding Syntax: padding-top: <value> Possible Values: <length> | <percentage> Initial Value: 0 Applies to: All elements Inherited: No The padding-top property describes how much space to put between the top border and the content of the selector. The value is either a length or a percentage. Percentage values refer to the parent element's width. Negative values are not permitted. Right Padding Syntax: padding-right: <value> Possible Values: <length> | <percentage> Initial Value: 0 Applies to: All elements Inherited: No The padding-right property describes how much space to put between the right border and the content of the selector. The value is either a length or a percentage. Percentage values refer to the parent element's width. Negative values are not permitted. Bottom Padding Syntax: padding-bottom: <value> Possible Values: <length> | <percentage> Initial Value: 0 Applies to: All elements Inherited: No The padding-bottom property describes how much space to put between the bottom border and the content of the selector. The value is either a length or a percentage. Percentage values refer to the parent element's width. Negative values are not permitted. Left Padding

Information Technology, Prepared by Subashini.N.J

Page 34

IT0306 Web Systems and Technology- CSS Properties


Syntax: padding-left: <value> Possible Values: <length> | <percentage> Initial Value: 0 Applies to: All elements Inherited: No The padding-left property describes how much space to put between the left border and the content of the selector. The value is either a length or a percentage. Percentage values refer to the parent element's width. Negative values are not permitted. Padding Syntax: padding: <value> Possible Values: [ <length> | <percentage> ]{1,4} Initial Value: 0 Applies to: All elements Inherited: No The padding property is a shorthand for the padding-top, padding-right, padding-bottom, and padding-left properties. An element's padding is the amount of space between the border and the content of the element. Between one and four values are given, where each value is either a length or a percentage. Percentage values refer to the parent element's width. Negative values are not permitted. If four values are given, they apply to top, right, bottom, and left padding, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side. For example, the following rule sets the top padding to 2em, the right padding to 4em, the bottom padding to 5em, and the left padding to 4em: BLOCKQUOTE { padding: 2em 4em 5em } Top Border Width Syntax: border-top-width: <value> Possible Values: thin | medium | thick | <length> Initial Value: medium Applies to: All elements Inherited: No The border-top-width property is used to specify the width of an element's top border. The value may be one of three keywords, which are not affected by font size, or a length, which can be used to achieve relative widths. Negative values are not allowed. One may also use the border-top, border-width, or border shorthand properties. Right Border Width Syntax: border-right-width: <value> Possible Values: thin | medium | thick | <length> Initial Value: medium
Information Technology, Prepared by Subashini.N.J Page 35

IT0306 Web Systems and Technology- CSS Properties


Applies to: All elements Inherited: No The border-right-width property is used to specify the width of an element's right border. The value may be one of three keywords, which are not affected by font size, or a length, which can be used to achieve relative widths. Negative values are not allowed. One may also use the border-right, border-width, or border shorthand properties. Bottom Border Width Syntax: border-bottom-width: <value> Possible Values: thin | medium | thick | <length> Initial Value: medium Applies to: All elements Inherited: No The border-bottom-width property is used to specify the width of an element's bottom border. The value may be one of three keywords, which are not affected by font size, or a length, which can be used to achieve relative widths. Negative values are not allowed. One may also use the border-bottom, border-width, or border shorthand properties. Left Border Width Syntax: border-left-width: <value> Possible Values: thin | medium | thick | <length> Initial Value: medium Applies to: All elements Inherited: No The border-left-width property is used to specify the width of an element's left border. The value may be one of three keywords, which are not affected by font size, or a length, which can be used to achieve relative widths. Negative values are not allowed. One may also use the border-left, border-width, or border shorthand properties. Border Width Syntax: border-width: <value> Possible Values: [ thin | medium | thick | <length> ]{1,4} Initial Value: Not defined Applies to: All elements Inherited: No The border-width property is used to set the border width of an element by specifying between one and four values, where each value is a keyword or a length. Negative lengths are not permitted. If four values are given, they apply to top, right, bottom, and left border width, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side.

Information Technology, Prepared by Subashini.N.J

Page 36

IT0306 Web Systems and Technology- CSS Properties


This property is a shorthand for the border-top-width, border-right-width, border-bottomwidth, and border-left-width properties. One may also use the border shorthand property. Border Color Syntax: border-color: <value> Possible Values: <color>{1,4} Initial Value: The value of the color property Applies to: All elements Inherited: No The border-color property sets the color of an element's border. Between one and four color values are specified. If four values are given, they apply to top, right, bottom, and left border color, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side. One may also use the border shorthand property. Border Style Syntax: border-style: <value> Possible Values: [ none | dotted | dashed | solid | double | groove | ridge | inset | outset ]{1,4} Initial Value: none Applies to: All elements Inherited: No The border-style property sets the style of an element's border. This property must be specified for the border to be visible. Between one and four keywords are specified. If four values are given, they apply to top, right, bottom, and left border style, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side. One may also use the border shorthand property. Top Border Syntax: border-top: <value> Possible Values: <border-top-width> || <border-style> || <color> Initial Value: Not defined Applies to: All elements Inherited: No The border-top property is a shorthand for setting the width, style, and color of an element's top border. Note that only one border-style value may be given. One may also use the border shorthand property.

Information Technology, Prepared by Subashini.N.J

Page 37

IT0306 Web Systems and Technology- CSS Properties


Right Border Syntax: border-right: <value> Possible Values: <border-right-width> || <border-style> || <color> Initial Value: Not defined Applies to: All elements Inherited: No The border-right property is a shorthand for setting the width, style, and color of an element's right border. Note that only one border-style value may be given. One may also use the border shorthand property. Bottom Border Syntax: border-bottom: <value> Possible Values: <border-bottom-width> || <border-style> || <color> Initial Value: Not defined Applies to: All elements Inherited: No The border-bottom property is a shorthand for setting the width, style, and color of an element's bottom border. Note that only one border-style value may be given. One may also use the border shorthand property. Left Border Syntax: border-left: <value> Possible Values: <border-left-width> || <border-style> || <color> Initial Value: Not defined Applies to: All elements Inherited: No The border-left property is a shorthand for setting the width, style, and color of an element's left border. Note that only one border-style value may be given. One may also use the border shorthand property. Border Syntax: border: <value> Possible Values: <border-width> || <border-style> || <color> Initial Value: Not defined Applies to: All elements Inherited: No

Information Technology, Prepared by Subashini.N.J

Page 38

IT0306 Web Systems and Technology- CSS Properties


The border property is a shorthand for setting the width, style, and color of an element's border. Examples of border declarations include: H2 { border: groove 3em } A:link { border: solid blue } A:visited { border: thin dotted #800080 } A:active { border: thick double red } The border property can only set all four borders; only one border width and border style may be given. To give different values to an element's four borders, an author must use one or more of the border-top, border-right, border-bottom, border-left, border-color, border-width, border-style, border-top-width, border-right-width, border-bottom-width, or border-left-width properties. Width Syntax: width: <value> Possible Values: <length> | <percentage> | auto Initial Value: auto Applies to: Block-level and replaced elements Inherited: No Each block-level or replaced element can be given a width, specified as a length, a percentage, or as auto. (A replaced element is one for which only the intrinsic dimensions are known; HTML replaced elements include IMG, INPUT, TEXTAREA, SELECT, and OBJECT.) The initial value for the width property is auto, which results in the element's intrinsic width (i.e., the width of the element itself, for example the width of an image). Percentages refer to the parent element's width. Negative values are not allowed. This property could be used to give common widths to some INPUT elements, such as submit and reset buttons: INPUT.button { width: 10em } Height Syntax: height: <value> Possible Values: <length> | auto Initial Value: auto Applies to: Block-level and replaced elements Inherited: No Each block-level or replaced element can be given a height, specified as a length or as auto. (A replaced element is one for which only the intrinsic dimensions are known; HTML replaced elements include IMG, INPUT, TEXTAREA, SELECT, and OBJECT.) The initial value for the height property is auto, which results in the element's intrinsic height (i.e., the height of the element itself, for example the height of an image). Negative lengths are not allowed. As with the width property, height can be used to scale an image: IMG.foo { width: 40px; height: 40px }
Information Technology, Prepared by Subashini.N.J Page 39

IT0306 Web Systems and Technology- CSS Properties


In most cases, authors are advised to scale the image in an image editing program, since browsers will not likely scale images with high quality, and since scaling down causes the user to download an unnecessarily large file. However, scaling through the width and height properties is a useful option for user-defined style sheets in order to overcome vision problems. Float Syntax: float: <value> Possible Values: left | right | none Initial Value: none Applies to: All elements Inherited: No The float property allows authors to wrap text around an element. This is identical in purpose to HTML 3.2's ALIGN=left and ALIGN=right for the IMG element, but CSS1 allows all elements to "float," not just the images and tables that HTML 3.2 allows. Clear Syntax: clear: <value> Possible Values: none | left | right | both Initial Value: none Applies to: All elements Inherited: No The clear property specifies if an element allows floating elements to its sides. A value of left moves the element below any floating element on its left; right acts similarly for floating elements on the right. Other values are none, which is the initial value, and both, which moves the element below floating elements on both of its sides. This property is similar in function to HTML 3.2's <BR CLEAR=left|right|all|none>, but it can be applied to all elements. Classification Properties Display Whitespace List Style Type List Style Image List Style Position List Style Display Syntax: display: <value> Possible Values: block | inline | list-item | none Initial Value: block Applies to: All elements Inherited: No The display property is used to define an element with one of four values: block (a line break before and after the element) inline (no line break before and after the element)
Information Technology, Prepared by Subashini.N.J Page 40

IT0306 Web Systems and Technology- CSS Properties


list-item (same as block except a list-item marker is added) none (no display) Each element typically is given a default display value by the browser, based on suggested rendering in the HTML specification. The display property can be dangerous because of its ability to display elements in what would otherwise be an improper format. The use of the value none will turn off display of the element to which it is assigned, including any children elements! Whitespace Syntax: white-space: <value> Possible Values: normal | pre | nowrap Initial Value: normal Applies to: All elements Inherited: Yes The white-space property will determine how spaces within the element are treated. This property takes one of three values: normal (collapses multiple spaces into one) pre (does not collapse multiple spaces) nowrap (does not allow line wrapping without a <BR> tag) List Style Type Syntax: list-style-type: <value> Possible Values: disc | circle | square | decimal | lower-roman | upper-roman | loweralpha | upper-alpha | none Initial Value: disc Applies to: Elements with display value list-item Inherited: Yes The list-style-type property specifies the type of list-item marker, and is used if list-styleimage is none or if image loading is turned off. Examples: LI.square { list-style-type: square } UL.plain { list-style-type: none } OL { list-style-type: upper-alpha } /* A B C D E etc. */ OL OL { list-style-type: decimal } /* 1 2 3 4 5 etc. */ OL OL OL { list-style-type: lower-roman } /* i ii iii iv v etc. */ List Style Image Syntax: list-style-image: <value> Possible Values: <url> | none Initial Value: none Applies to: Elements with display value list-item Inherited: Yes The list-style-image property specifies the image that will be used as list-item marker when image loading is turned on, replacing the marker specified in the list-style-type property.

Information Technology, Prepared by Subashini.N.J

Page 41

IT0306 Web Systems and Technology- CSS Properties


Examples: UL.check { list-style-image: url(/LI-markers/checkmark.gif) } UL LI.x { list-style-image: url(x.png) } List Style Position Syntax: list-style-position: <value> Possible Values: inside | outside Initial Value: outside Applies to: Elements with display value list-item Inherited: Yes The list-style-position property takes the value inside or outside, with outside being the default. This property determines where the marker is placed in regard to the list item. If the value inside is used, the lines will wrap under the marker instead of being indented. An example rendering is: Outside rendering: * List item 1 second line of list item Inside rendering: * List item 1 second line of list item List Style Syntax: list-style: <value> Possible Values: <list-style-type> || <list-style-position> || <url> Initial Value: Not defined Applies to: Elements with display value list-item Inherited: Yes The list-style property is a shorthand for the list-style-type, list-style-position, and list-styleimage properties. Examples: LI.square { list-style: square inside } UL.plain { list-style: none } UL.check { list-style: url(/LI-markers/checkmark.gif) circle } OL { list-style: upper-alpha } OL OL { list-style: lower-roman inside } Units Length Units Percentage Units Color Units URLs Length Units A length value is formed by an optional + or -, followed by a number, followed by a twoletter abbreviation that indicates the unit. There are no spaces in a length value; e.g., 1.3 em is
Information Technology, Prepared by Subashini.N.J Page 42

IT0306 Web Systems and Technology- CSS Properties


not a valid length value, but 1.3em is valid. A length of 0 does not require the two-letter unit identifier. Both relative and absolute length units are supported in CSS1. Relative units give a length relative to another length property, and are preferred since they will better adjust to different media. The following relative units are available: em (ems, the height of the element's font) ex (x-height, the height of the letter "x") px (pixels, relative to the canvas resolution) Absolute length units are highly dependent on the output medium, and so are less useful than relative units. The following absolute units are available: in (inches; 1in=2.54cm) cm (centimeters; 1cm=10mm) mm (millimeters) pt (points; 1pt=1/72in) pc (picas; 1pc=12pt) Percentage Units A percentage value is formed by an optional + or -, followed by a number, followed by %. There are no spaces in a percentage value. Percentage values are relative to other values, as defined for each property. Most often the percentage value is relative to the element's font size. Color Units A color value is a keyword or a numerical RGB specification. The 16 keywords are taken from the Windows VGA palette: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. RGB colors are given in one of four ways: #rrggbb (e.g., #00cc00) #rgb (e.g., #0c0) rgb(x,x,x) where x is an integer between 0 and 255 inclusive (e.g., rgb(0,204,0)) rgb(y%,y%,y%) where y is a number between 0.0 and 100.0 inclusive (e.g., rgb(0%,80%,0%)) The examples above all specify the same color. Douglas R. Jacobson has also developed a handy quick reference RGB Color Chart (61 kB). URLs A URL value is given by url(foo), where foo is the URL. The URL may be optionally quoted with either single (') or double (") quotes and may contain whitespace before or after the (optionally quoted) URL.

Information Technology, Prepared by Subashini.N.J

Page 43

IT0306 Web Systems and Technology- CSS Properties


Parentheses, commas, spaces, single quotes, or double quotes in the URL must be escaped with a backslash. Partial URLs are interpreted relative to the style sheet source, not to the HTML source. Note that Netscape Navigator 4.x incorrectly interprets partial URLs relative to the HTML source. Given this bug, authors may wish to use full URLs where possible. Examples: BODY { background: url(stripe.gif) } BODY { background: url(http://www.htmlhelp.com/stripe.gif) } BODY { background: url( stripe.gif ) } BODY { background: url("stripe.gif") } BODY { background: url(\"Ulalume\".png) } /* quotes in URL escaped */

Information Technology, Prepared by Subashini.N.J

Page 44

S-ar putea să vă placă și