Openwave Mobile Browser 6.1 and 6.2: XHTML Mobile Profile and CSS Reference
Section 26 out of 38 total sections
Current chapter: CSS Reference

You can use the color and background properties to set foreground colors, background colors, and background images.

Sets the foreground color. The foreground is the content of the element, typically text, but also the rule drawn for the <hr> element, the color of any border (unless you set another color with one of the border properties), and so on.
See Colors.
All displayed elements except replaced, inline elements, such as <img> and <object>.
The variety of colors available depends on the phone.
h1 {color: red}
Displays the text of first-level heads in red.

Sets the background color of content and padding. (Content and padding are described in The CSS Box Model.)
See Colors, transparent
If you set a background color, take care to set the foreground to a contrasting color, so that its content remains visible.
The transparent value allows the parent element's color to shine through.
h1 {background-color: green}
Sets green as the background color the content and padding of all first level head.

Sets an image as a background pattern.
NOTE Background images can degrade the performance of your applications on real phones, because they take time to download and processor power to display. Test your applications on real phones. If performance is poor, try reducing the number and size of background images.
For more information, see URLs.
URLs includes information on how to take advantage of the Openwave icons and WAP pictograms included with the browser as background images.
blockquote {background-image: url("images/sand.gif")}
Displays the sand.gif image in the background area of the <blockquote> element.

Determines whether a background image repeats both horizontally and vertically (repeat), horizontally only (repeat-x), vertically only (repeat-y), or not at all (no-repeat).
repeat, repeat-x, repeat-y, no-repeat, or inherit
For more information, see Keywords.
If you set the value of background-repeat to no-repeat, the background image is displayed vertically centered behind the element block, and aligned left.
blockquote {background-image: url("images/sand.gif");background-repeat: repeat}
Displays the sand.gif image behind the entire content and padding regions of <blockquote> elements, repeating the image both horizontally and vertically to fit.

Determines the position of a background image in its block, or the starting position of the image if you repeat the image.
A single or a pair of units of measure or percentages; combinations of the keywords top, center, bottom, left, center, and right; inherit.
For more information, see Units of Measure, Percentage, Keywords.
Units of measure specify the distance from the top and left edge of the content or optional padding.
Percentages are relative to the dimensions of the block element's content plus optional padding. 0% 0% positions the image at the top left; 100% 100% positions the image at the bottom right.
A single unit of measure or percentage value sets the horizontal position only, centering the image vertically.
You can combine the keywords in many ways:
blockquote {background-image: url("images/sand.gif");background-position: top right}
Positions the sand.gif image behind the top right of <blockquote> elements.

For background images that are set behind an entire document, as a property applied to the <body> element, the background-attachment property determines whether a background image is fixed and content scrolls across it, or whether the background scrolls with the content.
The browser ignores this property if it is applied to any element except <body>.
body {background-image: url("waves.gif"); background-attachment: fixed}
Causes any content in the document to scroll across the waves.gif image.

A shortcut property that sets some or all of the background properties.
See the values for background-color, background-image, background-repeat, background-position, and background-attachment.
See the individual background properties.
Because they share no common values, you can use the individual background property values in any order.
Do not set a background-attachment value unless you are applying background to the <body> element.
blockquote {background: red url("images/sand.gif") no-repeat center}
Sets red as the background color and centers a single instance of the sand.gif image behind <blockquote> elements.

