These properties classify elements into categories more than they set specific visual parameters.
|
Value
|
block | inline | list-item | none block: The element will be displayed as a block-level element, with a line break before and after the element. Netscape 4.0, Internet Explorer 5.0 inline : The element will be displayed as an inline element, with no line break before or after the element. Netscape 7.0, Internet Explorer 4.0 list-item : The element will be displayed as a list. Netscape 4.0, Internet Explorer 4.0 none : The element will not be displayed. Netscape 4.0, Internet Explorer 4.0
Notes in IE 4.0: "display: none" on block elements take up place (insert a linefeed) Notes in IE 5.0: "display: inline" does not work properly on lists and list items Notes in Netscape 4.x:
|
|---|---|
|
Initial
|
block |
|
Applies to
|
all elements |
|
Inherited
|
no |
|
Percentage Values
|
N/A |
This property describes how/if an element is displayed on the canvas (which may be on a printed page, a computer display etc.).
An element with a 'display' value of 'block' opens a new box. The box is positioned relative to adjacent boxes according to the CSS formatting model. Typically, elements like 'H1' and 'P' are of type 'block'. A value of 'list-item' is similar to 'block' except that a list-item marker is added. In HTML, 'LI' will typically have this value.
An element with a 'display' value of 'inline' results in a new inline box on the same line as the previous content. The box is dimensioned according to the formatted size of the content. If the content is text, it may span several lines, and there will be a box on each line. The margin, border and padding properties apply to 'inline' elements, but will not have any effect at the line breaks.
A value of 'none' turns off the display of the element, including children elements and the surrounding box.
|
P { display: block } |
The last rule turns off the display of images.
The initial value of 'display' is 'block', but a UA will typically have default values for all HTML elements according to the suggested rendering of elements in the HTML specification.
CSS1 core: UAs may ignore 'display' and use only the UA's default values.
|
Example: Source code: <p><div style="display: none">...</div><br> Output: <div style="display: none">...</div> <END div HERE
|
|
Example: Source code: <p><p style="display: inline">...</p><br> Output: <p style="display: inline">...</p> This first paragraph has <p style="display: inline">...</p>. However, it does not displayed inline with the previous paragraph. This second paragraph also has <p style="display: inline">...</p>. It should be displayed inline with the previous paragraph. <END p HERE |
|
Example: Source code: <style> Output: This paragraph should not be displayed. Now, this paragraph should be displayed with yellow background color.
|
|
Value
|
normal | pre | nowrap normal : White-space is ignored by the browser. Netscape 4.0, Internet Explorer 5.5 pre : White-space is preserved by the browser. Acts like the <pre> tag in HTML. Netscape 4.0 nowrap : The text will never wrap, it continues on the same line until a <br> tag is encountered. Netscape 6.0, Internet Explorer 5.5 |
|---|---|
|
Initial
|
normal |
|
Applies to
|
block-level elements |
|
Inherited
|
yes |
|
Percentage Values
|
N/A |
This property declares how whitespace inside the element is handled: the 'normal' way (where whitespace is collapsed), as 'pre' (which behaves like the 'PRE' element in HTML) or as 'nowrap' (where wrapping is done only through BR elements):
|
PRE { white-space: pre } |
The initial value of 'white-space' is 'normal', but a UA will typically have default values for all HTML elements according to the suggested rendering of elements in the HTML specification [2].
CSS1 core: UAs may ignore the 'white-space' property in author's and reader's style sheets, and use the UA's default values instead.
|
Example: Source code: <p style="whitespace: normal; background-color:
yellow">This is a long paragraph with Output: This is a long paragraph with normal whitespace and yellow background. This is a long paragraph with normal whitespace and yellow background. This is a long paragraph with normal whitespace and yellow background. This is a long paragraph with nowrap whitespace and yellow background. This is a long paragraph with nowrap whitespace and yellow background. This is a long paragraph with nowrap whitespace and yellow background. This is a long paragraph with pre whitespace and yellow background. This is a long paragraph with pre whitespace and yellow background. This is a long paragraph with pre whitespace and yellow background. |
|
Value
|
[ [<uri> ,]* [ auto | crosshair | default | pointer | move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize| text | wait | help ] ] | inherit url : The user agent retrieves the cursor from the resource designated by the URI. If the user agent cannot handle the first cursor of a list of cursors, it should attempt to handle the second, etc. If the user agent cannot handle any user-defined cursor, it must use the generic cursor at the end of the list. Netscape 6.0 only. Note: Always define a generic cursor at the end of the list in case none of the url-defined cursors can be used auto : The UA determines the cursor to display based on the current context crosshair : A simple crosshair (e.g., short line segments resembling a "+" sign). default : The platform-dependent default cursor. Often rendered as an arrow. pointer : The cursor is a pointer that indicates a link. move : Indicates something is to be moved. e-resize : The cursor indicates that an edge of a box is to be moved right (east) ne-resize : The cursor indicates that an edge of a box is to be moved up and right (north/east) nw-resize : The cursor indicates that an edge of a box is to be moved up and left (north/west) n-resize : The cursor indicates that an edge of a box is to be moved up (north) se-resize : The cursor indicates that an edge of a box is to be moved down and right (south/east) sw-resize : The cursor indicates that an edge of a box is to be moved down and left (south/west) s-resize : The cursor indicates that an edge of a box is to be moved down (south) w-resize : The cursor indicates that an edge of a box is to be moved left (west text : Indicates text that may be selected. Often rendered as an I-bar. wait : Indicates that the program is busy and the user should wait. Often rendered as a watch or hourglass. help : Help is available for the object under the cursor. Often rendered as a question mark or a balloon. Netscape 6.0, Internet Explorer 4.0 Notes in IE 4.0+:
|
|---|---|
|
Initial
|
auto |
|
Applies to
|
all elements |
|
Inherited
|
yes |
|
Percentage Values
|
N/A |
The cursor property specifies the type of cursor to be displayed when pointing on an element.
|
P { cursor : url("mything.cur"), url("second.csr"), text; } |
|
Example: Source code: <p>Move the mouse over the words to see the cursor change.</p> Output: Move the mouse over the words to see the cursor change. AutoCrosshair Default Pointer Move e-resize ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize Text Wait Help
|
|
Value
|
static | relative | absolute | fixed | inherit static : The box is a normal box, laid out according to the normal flow. The 'left' and 'top' properties do not apply. The element is placed in a normal position (according to the normal flow). With the value of "static" we do not use the "left" and "top" properties. Netscape 4.0, Internet Explorer 4.0. relative : The box's position is calculated according to the normal flow (this is called the position in normal flow). Then the box is offset relative to its normal position. When a box B is relatively positioned, the position of the following box is calculated as though B were not offset. Moves an element relative to its normal position, so "left:20" adds 20 pixels to the element's LEFT position. Netscape 4.0, Internet Explorer 4.0. absolute : The box's position (and possibly size) is specified with the 'left', 'right', 'top', and 'bottom' properties. These properties specify offsets with respect to the box's containing block. Absolutely positioned boxes are taken out of the normal flow. This means they have no impact on the layout of later siblings. Also, though absolutely positioned boxes have margins, they do not collapse with any other margins. With a value of "absolute" the element can be placed anywhere on a page. The element's position is specified with the "left", "top", "right", and "bottom" properties. Netscape 4.0, Internet Explorer 4.0. fixed : The box's position is calculated according to the 'absolute' model, but in addition, the box is fixed with respect to some reference. In the case of continuous media, the box is fixed with respect to the viewport (and doesn't move when scrolled). In the case of paged media, the box is fixed with respect to the page, even if that page is seen through a viewport (in the case of a print-preview, for example). Authors may wish to specify 'fixed' in a media-dependent way. For instance, an author may want a box to remain at the top of the viewport on the screen, but not at the top of each printed page. The two specifications may be separated by using an @media rule, as in: Example(s): @media screen { Netscape 4.0, Internet Explorer 4.0 Notes in IE 4.0+:
Notes in IE 5.0: Absolute positioning works with inline elements, lists, and table cells Notes in Netscape 4.0+:
|
|---|---|
|
Initial
|
static |
|
Applies to
|
all elements, but not to generated content |
|
Inherited
|
no |
|
Percentage Values
|
N/A |
The position property places an element in a static, relative, absolute or fixed position.
|
h1 |
|
Example: position: relative Source code: <p>This is a normal paragraph position</p> Output: This is a normal paragraph position This paragraph has position: relative and left: 50 pixels. This is a normal paragraph position This paragraph has position: relative and left: -50 pixels. This is a normal paragraph position This paragraph has position: relative and right: 50 pixels. This is a normal paragraph position This paragraph has position: relative and right: -50 pixels. This is a normal paragraph position
|
|
Example: position: absolute Source code: <html> <body bgcolor="#FFFFFF" text="#000000"> Output: Click here to see the output of the above example. |
|
Value
|
visible | hidden | collapse | inherit visible : The generated box is visible. Netscape 6.0, Internet Explorer 4.0 hidden : The generated box is invisible (fully transparent), but still affects layout. Netscape 6.0, Internet Explorer 4.0 collaspse : When used in table elements, this value removes a row or column, but it does not affect the table layout. The space taken up by the row or column will be available for other content. If this value is used on other elements, it renders as "hidden". Please consult the section on dynamic row and column effects in tables. If used on elements other than rows or columns, 'collapse' has the same meaning as 'hidden'. Netscape 6.0 only. Notes in IE 4.0+:
Notes in IE 5.0: Absolute positioning works with inline elements, lists, and table cells Notes in Netscape 4.0+:
|
|---|---|
|
Initial
|
static |
|
Applies to
|
all elements, but not to generated content |
|
Inherited
|
no |
|
Percentage Values
|
N/A |
The 'visibility' property specifies whether the boxes generated by an element are rendered. Invisible boxes still affect layout (set the 'display' property to 'none' to suppress box generation altogether). The visibility property sets if an element should be visible or invisible.
Note: Invisible elements takes up space on the page. Use the "display" property to create invisible elements that do not take up space.
Note: This property is used with scripts to create Dynamic HTML.
|
p |
|
Example: Source code: <p>This is a normal paragraph.</p> Output: This is a normal paragraph. This paragraph has visibility: visible. This is a normal paragraph. Note: The visibility: hidden paragraph takes space. This is a normal paragraph. Note: The display: none paragraph does not take space.
|
|
Example: Source code: <html> <body bgcolor="#FFFFFF" text="#000000"> <DIV id="container2"> <FORM method="post"> <p> </p> Output: Click here to see the output of the above example. |