CSS Properties
CSS Properties
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.
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
Page 1
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
border-top-width
div { border-topwidth:2px; } div { border-topwidth:thin; } div { bordertop:2px solid green; } div { bordertop:thick double #00FF00; }
border-top
border-right-color
Valid color names, RGB values, div { borderhexidecimal notation, or the right-
Page 2
border-right-style
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
div { borderright-width:2px; } div { borderright-width:thin; } div { borderright:2px solid green; } div { borderright:thick double #00FF00; }
border-right
border-bottom-color
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
Page 3
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
border-left-width
div { border-leftwidth:2px; } div { border-leftwidth:thin; } div { borderleft:2px solid green; } div { borderleft:thick double #00FF00; }
border-left
border-color
Declares the
border-style
div { borderstyle:solid dotted dashed double; } div { borderstyle:solid; } div { borderstyle:solid dotted; } div { borderstyle:solid dotted dashed; }
Page 5
border
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
Page 6
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.
visibility
top
right
Lengths,
div { right:15px; }
Page 7
left
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
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
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%; }
min-height
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
Page 9
font-size
Declares the size of the font. Previously set in HTML via the size attribute in a <font> tag.
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.
normal wider narrower ultra-condensed extra-condensed condensed semi-condensed semi-expanded expanded extra-expanded ultra-expanded
Page 10
font-variant
font-weight
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) ;}
Page 11
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; }
ol { list-styleposition:inside; } ul { list-style-
Page 12
marker-offset
Declares the marker Lengths and the offset for elements with a predefined value ofmarker set for valueauto. the displayproperty.
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
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.
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
outline-style
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
div { outlinewidth:2px; } div { outlinewidth:thin; } div { outline:green solid 2px; } div { outline:#00FF00 double thick; }
outline
Page 14
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.
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; }
Page 15
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-spacing
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
Page 16
empty-cells
table-layout
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
line-height
text-align
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
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
Page 18
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
Page 19
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
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
pitch-range
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
richness
speak
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
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
Page 23
Page 24
Page 29
Page 32
Page 33
Page 34
Page 36
Page 37
Page 38
Page 41
Page 43
Page 44