CSS 2.1 Properties
Property:
backgroundMedia Type(s):
VisualDescription:
Shorthand property for all individual background propertiesExample:
Tips:
body: {
background: url(images/body-back.gif) #ccc 50% no-repeat fixed;
}
Shorthand properties are often unique. In this case, you need to watch order: image, color, position, repeat, and attachment. If you aren't using all the options, just be sure to keep the integrity of the order.Property:
background-attachmentDescription:
Used to manage scrolling of backgroundsMedia Type(s):
VisualExample:
Tips:
body {
background-attachment: scroll;
}
A scroll value means the background scrolls with the content; if fixed is used, the background remains fixed while the content scrolls over it.Property:
background-colorDescription:
Defines a color for an element backgroundMedia Type(s):
VisualExample:
Tips:
div#content {
background-color: #fff;
}
Use a background color along with a background image, and choose a color that is close to the end effect of the image. This will help you avoid problems that can arise when a background image doesn't load for some reason.Property:
background-imageDescription:
Specifies an image path for an element backgroundMedia Type(s):
VisualExample:
Tips:
div#nav {
background-image: url(images/nav.gif);
}
You will sometimes see quotations around the image's path and filename. This is not necessary; leaving out the quotes might actually save you a few bytes of data.Property:
background-positionDescription:
Enables you to position a background image in relation to its elementMedia Type(s):
VisualExample:
Tips:
div#nav {
background-position: top left;
}
You can position backgrounds using percentages or length value keywords (top, right, center, bottom, left). If only one value is given, it sets the horizontal position only. If both values are provided, the horizontal value is first in the order. You can use negative position percentage values.Property:
background-repeatDescription:
Describes the way a background image repeats or does not repeatMedia Type(s):
VisualExample:
Tips:
div#content {
background-repeat: repeat-x;
}
Once upon a time, all backgrounds simply tiled into the main body. Now you can control tiling within an element, tile the image completely, tile only along the x- or y-axis, or not tile at all.Property:
borderDescription:
Shorthand property that enables you to apply width, style, and color to all four sides of an element boxMedia Type(s):
VisualExample:
Tips:
blockquote {
border: 1px dotted red;
}
Using the border property to help outline elements can be very helpful for diagnostics, as well as provide a nice design option for the element's presentation. You cannot set four different sides using this shorthand property; you need to specify the longhand, individual sides to do so.Property:
border-collapseDescription:
Defines the border model for table borders. A value of separate enables you to display cell borders separately; a value of collapse sets the collapsing border model.Media Type(s):
VisualExample:
Tips:
#table01 {
border-collapse: separate;
}
The model you choose to display table borders is wholly an aesthetic choice.Property:
border-colorDescription:
Sets a border color for any element. Can be used in place of border-top-color, border-right-color, border-bottom-color, and border-left-color.Media Type(s):
VisualExample:
Tips:
#sidebar {
border-color: red blue green yellow;
}
If you're setting more than one color, you must follow the TRouBLe order rule: top, right, bottom, left. If there is only one value, it applies to all sides. If there are two values, the top and bottom borders are set to the first value, and the right and left are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and left.Property:
border-spacingDescription:
Defines the space between adjoining cells within tablesMedia Type(s):
VisualExample:
Tips:
table {
border-spacing: 1.0em;
}
If one length is specified, it gives both the horizontal and vertical spacing. If two are specified, the first gives the horizontal spacing and the second the vertical spacing. Lengths may not be negative.Property:
border-styleDescription:
Sets the style of an element's borders. Can be used in place of border-top-style, border-bottom-style, border-left-style, and border-right-style.Media Type(s):
VisualExample:
Tips:
#sidebar {
border-style: solid dotted dashed none;
}
If you're setting more than one style, you must follow the TRouBLe order rule: top, right, bottom, left. If there is only one value, it applies to all sides. If there are two values, the top and bottom borders are set to the first value, and the right and left are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and left.Property:
border-topDescription:
Shorthand property to style an element's top border with a width, style, and colorMedia Type(s):
VisualExample:
Tips:
#sidebar {
border-top: 2px dashed green;
}
You don't have to use all three values. If you want to set only the width, for example, you can do so and use the border-style and border-color properties to set those values.Property:
border-rightDescription:
Shorthand property to style an element's right border with a width, style, and colorMedia Type(s):
VisualExample:
Tips:
#sidebar {
border-right: 2px solid green;
}
You don't have to use all three values. If you want to set only the width, for example, you can do so and use the border-style and border-color properties to set those values.Property:
border-bottomDescription:
Shorthand property to style an element's bottom border with a width, style, and colorMedia Type(s):
VisualExample:
Tips:
#sidebar {
border-bottom: 2px dashed green;
}
You don't have to use all three values. If you want to set only the width, for example, you can do so and use the border-style and border-color properties to set those values.Property:
border-leftDescription:
Shorthand property to style an element's left border with a width, style, and colorMedia Type(s):
VisualExample:
Tips:
#sidebar {
border-bottom: 2px solid green;
}
You don't have to use all three values. If you want to set only the width, for example, you can do so and use the border-style and border-color properties to set those values.Property:
border-top-colorDescription:
Sets the color for the top border of an elementMedia Type(s):
VisualExample:
Tips:
#nav {
border-top-color: #c30;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary.Property:
border-right-colorDescription:
Sets the color for the right border of an elementMedia Type(s):
VisualExample:
Tips:
#nav {
border-right-color: red;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary.Property:
border-bottom-colorDescription:
Sets the color for the bottom border of an elementMedia Type(s):
VisualExample:
Tips:
#nav {
border-bottom-color: #808080;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary.Property:
border-left-colorDescription:
Sets the color for the left border of an elementMedia Type(s):
VisualExample:
Tips:
#nav {
border-left-color: red;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary.Property:
border-top-styleDescription:
Sets the style for the top border of an elementMedia Type(s):
VisualExample:
Tips:
blockquote {
border-top-style: dashed;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary. Styles include dotted, dashed, solid, double, groove, ridge, inset, and outset. There are also values for none (displays none) and hidden.Property:
border-right-styleDescription:
Defines the style for the right border of an elementMedia Type(s):
VisualExample:
Tips:
blockquote {
border-right-style: groove;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary. Styles include dotted, dashed, solid, double, groove, ridge, inset, and outset. There are also values for none (displays none) and hidden.Property:
border-bottom-styleDescription:
Sets the style for the bottom border of an elementMedia Type(s):
VisualExample:
Tips:
blockquote {
border-bottom-style: ridge;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary. Styles include dotted, dashed, solid, double, groove, ridge, inset, and outset. There are also values for none (displays none) and hidden.Property:
border-left-styleDescription:
Sets the style for the left border of an elementMedia Type(s):
VisualExample:
Tips:
blockquote {
border-left-style: none;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary. Styles include dotted, dashed, solid, double, groove, ridge, inset, and outset. There are also values for none (displays none) and hidden.Property:
border-top-widthDescription:
Sets a width for the top border of an elementMedia Type(s):
VisualExample:
Tips:
#content {
border-top-width: 2px;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary.Property:
border-right-widthDescription:
Defines the width for the right border of an elementMedia Type(s):
VisualExample:
Tips:
#content {
border-right-width: 4px;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary.Property:
border-bottom-widthDescription:
Defines the width for the bottom border of an elementMedia Type(s):
VisualExample:
Tips:
#content {
border-bottom-width: 2px;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary.Property:
border-left-widthDescription:
Sets the width for the left border of an elementMedia Type(s):
VisualExample:
Tips:
#content {
border-left-width: 4px;
}
Using shorthand options can result in more streamlined CSS. Use longhand border properties only when really necessary.Property:
border-widthDescription:
Shorthand property used to define the width of an element's bordersMedia Type(s):
VisualExample:
Tips:
#content {
border-width: 2px 4px 8px 10px;
}
If you're setting more than one side's width, you must follow the TRouBLe order rule: top, right, bottom, left. If there is only one value, it applies to all sides. If there are two values, the top and bottom borders are set to the first value, and the right and left are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and left.Property:
bottomDescription:
Specifies the offset of a positioned box's bottomMedia Type(s):
ValueExample:
Tips:
#content {
position: absolute;
bottom: 45px;
}
The positioning scheme used affects which aspect of the element box will be offset. Absolutely positioned boxes compute the value according to the containing block. With relatively positioned boxes, the offset is in relation to the element's box.Property:
caption-sideDescription:
Used to position the caption box in tables with a caption elementMedia Type(s):
VisualExample:
Tips:
caption {
caption-side: bottom;
}
Poor support in current browsers limits the use of this property.Property:
clearDescription:
Used to clear elements away from floated elements.Media Type(s):
VisualExample:
Tips:
#tipscolumn {
clear: both;
}
Values include left, right, and both. This property is used in the same manner the HTML clear attribute was used in presentational markup.Property:
clipDescription:
Defines which portion of a box is visibleMedia Type(s):
VisualExample:
Tips:
#dynamicbox {
clip: rect(15px, 20px, 15px, 25px);
}
This property is often used along with scripting and the Document Object Model (DOM) to add a dynamic behavior to the element in question.Property:
colorDescription:
Defines the foreground color of an element's text contentMedia Type(s):
VisualExample:
Tips:
p {
color: blue;
}
No known issues exist. This property has been in widespread use since the earliest days of CSS.Property:
contentDescription:
Used for generated content along with the pseudo elements :before and :afterMedia Type(s):
AllExample:
Tips:
a:after {
content: "link"
}
Generated content is not supported by IE 6.0. As a result, use of this property is, unfortunately, quite limited at this time.Property:
cursorDescription:
Defines the kind of cursor to be displayedMedia Type(s):
Visual, interactiveExample:
Tips:
a {
cursor: pointer;
}
This property is very helpful in providing additional cues about an item that has focus. It is useful for accessibility and improved usability.Property:
directionDescription:
Specifies writing direction within blocksMedia Type(s):
VisualExample:
Tips:
p {
direction: rtl;
}
Values are rtl (right to left) and ltr (left to right). This is incredibly important in internationalization and multilingual document development.Property:
displayDescription:
Sets the visual display type of an elementMedia Type(s):
AllExample:
Tips:
ul, li {
display: inline;
}
This property is extremely useful for layout and navigation design in contemporary practices.Property:
empty-cellsDescription:
Determines whether to show or hide empty cells within a tableMedia Type(s):
VisualExample:
Tips:
table {
Empty-cells: show;
}
This property is used with the separated borders model (see border-collapse).Property:
floatDescription:
Allows an element to be floated to the right or leftMedia Type(s):
VisualExample:
Tips:
#contentcolumn {
float: right;
}
Floats were originally developed to manage such floating elements as images.Property:
fontDescription:
Shorthand property to manage font displayMedia Type(s):
VisualExample:
Tips:
p {
font: italic small-caps bold 100%/100% Arial, sans-serif;
}
You must always follow the required order with the font shorthand property: font-style, font-variant, font-weight, font-size/line-height, font-family. You do not need to include all properties, but the order is significant. You must also have at least the font size and family identified.Property:
font-familyDescription:
Sets the font family for the element's textMedia Type(s):
VisualExample:
Tips:
p {
font-family: Georgia, "Times New Roman", serif;
}
It's always wise to include the generic font family (serif, sans-serif, fantasy, monospace) for the fonts you're using. Also, note that each font name is comma delimited, and the only time quotes are used is for multiword font names.Property:
font-sizeDescription:
Determines the size of the fontMedia Type(s):
VisualExample:
Tips:
.notation {
font-size: small;
}
You can use absolute sizing via keywords (xx-small to xx-large), relative sizing keywords (larger, smaller), and the common length and percentage values.Property:
font-styleDescription:
Sets the font's style, typically italic and obliqueMedia Type(s):
VisualExample:
Tips:
.notation {
font-style: italic;
}
Use font styles for auxiliary text such as notes and captions. Italic and oblique styles are not ideal for larger sections of text.Property:
font-variantDescription:
Sets a variant of small capsMedia Type(s):
VisualExample:
Tips:
h1 {
font-variant: small-caps;
}
This property can be very useful for creating attractive headings and accent text. It is not meant for body text. If a browser doesn't support the property, normal display of the font occurs.Property:
font-weightDescription:
Sets the weight of the fontMedia Type(s):
VisualExample:
Tips:
.highlight {
font-weight: bold;
}
Numeric values 100 to 900 are inconsistently supported and, therefore, should not be relied upon.Property:
heightDescription:
Sets the content height of an elementMedia Type(s):
VisualExample:
Tips:
#content {
height: 400px;
}
This property is inconsistently supported and should not be relied upon. Note that height does not apply to nonreplaced inline elements.Property:
letter-spacingDescription:
Specifies spacing between text charactersMedia Type(s):
VisualExample:
Tips:
#content p {
letter-spacing: 0.1em;
}
Designers with a taste for control over type appreciate this property, but support is somewhat inconsistent. If a browser can't render the property, the default spacing is used.Property:
line-heightDescription:
Describes the height of a given line of textMedia Type(s):
VisualExample:
Tips:
#content p {
line-height: 120%;
}
Typically, line-height should be close to the size of the font. The shorter the line height is in relation to the font, the closer the lines will be, and vice versa. Too much or too little space in either direction can cause problems with readability.Property:
list-styleDescription:
Shorthand property to manage the list's type, position, and imageMedia Type(s):
VisualExample:
Tips:
#content ul {
list-style: disc outside url(images/bullet.gif);
}
If the image is unavailable, the style disc will be displayed in its place.Property:
list-style-imageDescription:
Adds an image to list itemsMedia Type(s):
VisualExample:
Tips:
#nav ul {
list-style-image: url(images/nav-bullet.gif);
}
If you'd like to add a list style in case the image doesn't load, you can gain a little more control over display. If you don't add a list style value and the image doesn't display, the default list style for that list type will be displayed.Property:
list-style-positionDescription:
Describes the positioning of the marker box for the listMedia Type(s):
VisualExample:
Tips:
#content ul {
list-style-position: inside;
}
A value of inside starts the second line of text within a list item directly below the marker. A value of outside starts the second line of text within a list item outside the box, resulting in the conventional and familiar indents seen in most lists.Property:
list-style-typeDescription:
Sets the style of the list markerMedia Type(s):
VisualExample:
Tips:
#content ol {
list-style-type: decimal-leading-zero;
}
Markers include disc, circle, square, decimal, decimal-leading-zero, lower-roman, upper-roman, lower-greek, lower-latin, upper-latin, armenian, georgian, none, and inherit. Note that a value of none removes all markers, which is useful in list-based navigation design.Property:
marginDescription:
Shorthand property for an element's margin values.Media Type(s):
VisualExample:
Tips:
#content {
margin: 10px 20px 30px;
}
You must follow the TRouBLe order rule: top, right, bottom, left. If there is only one value, it applies to all sides. If there are two values, the top and bottom borders are set to the first value, and the right and left are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and left. Margin values are not inherited.Property:
margin-rightDescription:
Sets the margin for an element's right marginMedia Type(s):
VisualExample:
Tips:
#nav {
margin-right: 20px;
}
Margin values are not inherited.Property:
margin-leftDescription:
Sets the margin for an element's left marginMedia Type(s):
VisualExample:
Tips:
#nav {
margin-left: 2.0em;
}
Margin values are not inherited.Property:
margin-topDescription:
Sets the margin for an element's top marginMedia Type(s):
VisualExample:
Tips:
#nav {
margin-top: 10%;
}
Margin values are not inherited.Property:
margin-bottomDescription:
Defines the margin for an element's bottom marginMedia Type(s):
VisualExample:
Tips:
#nav {
margin-bottom: 20px;
}
Margin values are not inherited.Property:
max-heightDescription:
Sets a maximum height for an element boxMedia Type(s):
VisualExample:
Tips:
h2 {
max-height: 35px;
}
No negative values are allowed. This doesn't apply to nonreplaced inline elements or tables.Property:
max-widthDescription:
Sets a maximum widthMedia Type(s):
VisualExample:
Tips:
p {
max-width: 80%
}
This property is helpful in limiting lines of text so they don't become overly long. Unfortunately, this property is unsupported in Internet Explorer 6.0, causing frustration for visual designers who appreciate being able to have this intended level of typographic control.Property:
min-heightDescription:
Sets a minimum height for an element boxMedia Type(s):
VisualExample:
Tips:
h2 {
min-height: 100px;
}
This doesn't apply to nonreplaced inline elements or tables.Property:
min-widthDescription:
Sets a minimum width for an element boxMedia Type(s):
VisualExample:
Tips:
p {
min-width: 80%
}
This property is helpful in ensuring that lines of text are at least a minimum width. Unfortunately, this property is unsupported in Internet Explorer 6.0, causing frustration for visual designers who appreciate being able to have this intended level of typographic control.Property:
outlineDescription:
Shorthand that creates a dynamic outline for form controls and objectsMedia Type(s):
Visual, interactiveExample:
Tips:
img {
outline: red solid thick;
}
All dynamic outline properties are unlike borders, in that they do not take up space (are not calculated as part of the box model width or height) and they may be nonrectangular. Support for these properties is very limited (Safari 1.2 has support for outline properties), so they are rarely used at this time.Property:
outline-colorDescription:
Defines an outline color for form controls and objectsMedia Type(s):
Visual, interactiveExample:
Tips:
img {
outline-color: blue;
}
All dynamic outline properties are unlike borders, in that they do not take up space (are not calculated as part of the box model width or height) and they may be nonrectangular. All colors are available for this property, with the addition of a value of invert. This inverts the color, which can be helpful to ensure that the outline is visible when the control or object is in focus. Support for these properties is very limited (Safari 1.2 has support for outline properties), so they are rarely used at this time.Property:
outline-styleDescription:
Sets an outline style for form controls and objectsMedia Type(s):
Visual, interactiveExample:
Tips:
img {
outline-style: groove;
}
All dynamic outline properties are unlike borders, in that they do not take up space (are not calculated as part of the box model width or height) and they may be nonrectangular. This property accepts the same styles as for border-style, with the exception of the hidden value. Support for these properties is very limited (Safari 1.2 has support for outline properties), so they are rarely used at this time.Property:
outline-widthDescription:
Sets the outline width for form controls and objectsMedia Type(s):
Visual, interactiveExample:
Tips:
input {
outline-width: 2px;
}
All dynamic outline properties are unlike borders, in that they do not take up space (are not calculated as part of the box model width or height) and they may be nonrectangular. This property accepts the same styles as for border-width. Support for these properties is very limited (Safari 1.2 has support for outline properties), so they are rarely used at this time.Property:
overflowDescription:
Used to manage content that overflows an element boxMedia Type(s):
VisualExample:
Tips:
#tipscolumn {
overflow: scroll;
}
Values include visible, which makes the content visible outside the box; hidden, which hides all overflow; scroll, which forces a scrollbar into the element box that contains the content; and auto, which automatically provides a scroll if it's required.Property:
paddingDescription:
Shorthand property to define the padding of an element boxMedia Type(s):
VisualExample:
Tips:
#content {
padding: 10px 20px 15px 0;
}
You must follow the TRouBLe order rule: top, right, bottom, left. If there is only one value, it applies to all sides. If there are two values, the top and bottom borders are set to the first value, and the right and left are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and left.Property:
padding-topDescription:
Sets the padding for the top of an element boxMedia Type(s):
VisualExample:
Tips:
#content>p {
padding-top: 10px;
}
Padding is considered a part of the box model, and values must be included when calculating widths and heights.Property:
padding-rightDescription:
Sets the padding for the right side of an element boxMedia Type(s):
VisualExample:
Tips:
#content p {
padding-right: 10%;
}
Padding is considered a part of the box model, and values must be included when calculating widths and heights.Property:
padding-bottomDescription:
Sets the padding for the bottom of an element boxMedia Type(s):
VisualExample:
Tips:
#content+p {
padding-bottom: 2.0em;
}
Padding is considered a part of the box model, and values must be included when calculating widths and heights.Property:
padding-leftDescription:
Sets the padding for the left side of an element boxMedia Type(s):
VisualExample:
Tips:
#content {
padding-left: 16px;
}
Padding is considered a part of the box model, and values must be included when calculating widths and heights.Property:
page-break-afterDescription:
Forces a page to break according to the values includedMedia Type(s):
Visual, pagedExample:
Tips:
#content {
page-break-after: always;
}
The values for page-break properties include auto (no forced break), always (always force the break), avoid (avoid breaking a page at the element in question), left (break the page and resume content on the left page), and right (break the page and resume content on the right page).Property:
page-break-beforeDescription:
Forces a page to break according to the values includedMedia Type(s):
Visual, pagedExample:
Tips:
h2 {
page-break-before: right;
}
The values for page-break properties include auto (no forced break), always (always force the break), avoid (avoid breaking a page at the element in question), left (break the page and resume content on the left page), and right (break the page and resume content on the right page).Property:
page-break-insideDescription:
Forces a page to break according to the values includedMedia Type(s):
Visual, pagedExample:
Tips:
h2 {
page-break-inside: avoid;
}
The values for page-break properties include auto (no forced break), always (always force the break), avoid (avoid breaking a page at the element in question), left (break the page and resume content on the left page), and right (break the page and resume content on the right page).Property:
positionDescription:
Defines a positioning scheme of static, relative, absolute, or fixedMedia Type(s):
VisualExample:
Tips:
#topnav {
position: absolute;
top: 0;
left: 0;
}
Fixed positioning is not supported by Internet Explorer. Static positioning refers to the default normal flow of the browser.Property:
quotesDescription:
Specifies quotation marks for embedded quotationsMedia Type(s):
VisualExample:
Tips:
blockquote:before {
content: open-quote
}
blockquote:after {
content: close-quote
}
This property is typically used with generated content, as the example demonstrates. Because generated content is unavailable in older browsers and Internet Explorer 6.0, its use is limited to supported environments only, or workarounds are employed to manage other browsers.Property:
rightDescription:
Specifies a right margin offset in positioningMedia Type(s):
VisualExample:
Tips:
#topnav {
position: absolute;
right: 20px;
}
The positioning scheme used affects which aspect of the element box will be offset. Absolutely positioned boxes compute the value according to the containing block. With relatively positioned boxes, the offset is in relation to the element's box.Property:
table-layoutDescription:
Controls the way browsers manage tablesMedia Type(s):
VisualExample:
Tips:
table {
table-layout: fixed;
}
Two algorithms are used for managing tables. One is fixed, which is considered a faster rendering method because it doesn't depend upon the content of cells to determine width. The other is auto, which does depend on width and is the typical default behavior of most browsers. Although table-layout has fairly good support, the results vary enough among browsers that most people avoid using it and rely on the native agent's algorithm instead.Property:
text-alignDescription:
Specifies an alignment of left, right, center, or justify for textMedia Type(s):
VisualExample:
Tips:
p {
text-align: justify;
}
Broad browser support exists. Many designers recommend avoiding the justify value because they feel that it's not appropriate for onscreen; others feel that judicious use is fine.Property:
text-decorationDescription:
Sets a decoration for selected textMedia Type(s):
VisualExample:
Tips:
a {
text-decoration: none;
}
Values include none, underline, overline, line-through, and blink. The use of none with anchors as described in the example removes underlines from links. Most web designers avoid using underline because it's felt that underlining is too easily confused with the default behavior for links. The values of overline and line-through are typically used for editing or for whimsical design features. The blink value should be used with extreme caution; the fact that it even exists is probably more of an inside joke than a realistic desire to provide this less-than-accessible or attractive style to text.Property:
text-indentDescription:
Sets an indentationMedia Type(s):
VisualExample:
Tips:
p {
text-indent: 5px;
}
Using this property, you can create a very professional look for long sections of text. You may also use negative values to create an outdent effect.Property:
text-transformDescription:
Transforms selected text into capital case, upper case, or lower case, no matter how the text is input in the documentMedia Type(s):
VisualExample:
Tips:
h3 {
text-transform: uppercase;
}
Widespread support exists. This property is helpful in keeping headers and other important text items consistent.Property:
topDescription:
Specifies the offset of a positioned box's bottomMedia Type(s):
VisualExample:
Tips:
#nav {
position: relative; top: 20px;
}
The positioning scheme used affects which aspect of the element box will be offset. Absolutely positioned boxes compute the value according to the containing block. With relatively positioned boxes, the offset is in relation to the element's box.Property:
unicode-bidiDescription:
Helps to manage the bidirectional algorithm used to determine the direction of letters within a given languageMedia Type(s):
VisualExample:
Tips:
p.hebrew {
direction: rtl;
unicode-bidi: embed;
}
The use of unicode-bidi is limited to document authors concerned with maintaining control over the bidirectional algorithms within browsers.Property:
vertical-alignDescription:
Sets a vertical alignment using the keywords baseline, sub, super, top, text-top, middle, bottom, text-bottom, or a percentage or length value.Media Type(s):
VisualExample:
Tips:
img {
vertical-align: baseline;
}
This property works only with images in Netscape 4.x browsers.Property:
visibilityDescription:
Determines whether the box generated by an element will be rendered as visible, hidden, or collapsed.Media Type(s):
VisualExample:
Tips:
#container {
visibility: hidden;
}
Invisible boxes affect layout. If you want to completely suppress box generation, use the display property with a value of none instead. The collapse value is used with tables.Property:
white-spaceDescription:
Determines how whitespace within an element is managedMedia Type(s):
VisualExample:
Tips:
td {
white-space: nowrap;
}
Values are pre, which acts just like preformatted text; nowrap, which suppresses line breaks; pre-wrap, which breaks lines at new lines within the source; and pre-line, which collapses sequences of whitespace.Property:
widthDescription:
Sets the content width of an elementMedia Type(s):
VisualExample:
Tips:
#content p {
width: 225px;
}
This does not apply to nonreplaced inline elements.Property:
word-spacingDescription:
Sets the spacing between wordsMedia Type(s):
VisualExample:
Tips:
#content p {
word-spacing: 1.0em;
}
You can use negative values to decrease the space between words.Property:
z-indexDescription:
Used with position boxes to determine stacking orderMedia Type(s):
VisualExample:
Tips:
.boxtwo {
position: absolute;
top: 10px;
left: 10px;
z-index: 2;
}
The higher the integer is, the closer to the viewer the box in the stack appears.