All elements have a background area that can be filled with a solid color, gradient or image. Although part of the CSS2 specification, with CSS3 you can now designate multiple background images on the same element, which has necessitated some slight changes to the properties syntax.
Property |
Values |
Description |
background |
[<bg-layer>] # |
Specify multiple background colors or images on the same element in a comma-separated list. |
background-attatchment |
[inherit || scroll || fixed ||local] # |
Specifies how the background scrolls with the element. local will only scroll with its content, and not with the parent element. |
background-clip |
[inherit || border-box || padding-box || contentbox] # |
Specifies whether an element's background, either the color or image, extends underneath its border. This is important when the border is transparent. |
background-image |
[<url>} # |
Specify the path to one or morebackground images on thesame element in a commaseparated list. |
background-origin |
[inherit || border-box || padding-box || contentbox] # |
Specifies the location of the top right corner of the background in relation to the element box. |
background-position |
[<position>] # |
Specifies the initial position of the background in relation to its origin. |
background-repeat |
[inherit || repeat-x ||repeat-y || repeat || space || round || norepeat] # |
Specifies how the background is repeated in the element box. |
background-size |
[<length> || <percentage>|| auto || cover || contain] {1,2} # |
Specifies a size for the background image. Two values will set width and height. cover fills the entire element, contain shows the entire image in the background. |
Box-Shadow
Drop shadows are a common visual effect used to create a feeling of depth on a 2D screen.
Property |
Values |
Description |
box-shadow |
none | [inset? && [ <offset-x> <offset-y> <blurradius>? <spreadradius>? <color>? ] ]# |
Specify one or more "shadows" of any color in a comma-separated list, behind and/or inside (inset) the element's box. You can also control the horizontal and vertical offset the sharpness of the shadow (blur) and the distance of the solid area from the edge before the shadow fade begins (spread). |
![boxshadow](/storage/rc-covers/10863-thumb.png)
![Hot Tip](/storage/rc-covers/10864-thumb.png)
box-shadow is only supported in IE 9+ and some older versions of Firefox, Safari, and Chrome may require the browser extension to work.
Border Image
CSS3 introduces the ability to use an image file to create customized border styles. To do this, you will first need to create a bit map image, saved in a web-compatible format (e.g., PNG, GIF, or JPEG).
![border-image](/storage/rc-covers/10865-thumb.png)
The CSS slices the image into nine areas: the four corners, the four sides, and the center. The corners of the image will be used at the corners of the box, and each of the four sides are tiled horizontally or vertically
![border-image-slices](/storage/rc-covers/10866-thumb.png)
Then, use the properties below to set the image as the elements border.
Property |
Syntax |
Description |
border-image-outset |
[ <length> | <number> ]{1,4} |
One to four values that specify how far beyond the edge of the box the border image can extend without being clipped. |
border-image-repeat |
[ stretch | repeat | round ]{1,2} |
One or two values to specify how the image border behaves horizontally and vertically. |
border-image-slice |
[<number> | <percentage>]{1,4} && fill? |
One to four values that specify the distance sliced into the image from its outer top, right, bottom, and left sides to create the image border. If fill is included, the central part of the border image is used as the element's background image. |
border-image-source |
<url> |
Specifies the path to the image file being used as the border. |
border-image-width |
[<length> | <number> | <percentage>]{1,4} && fill? |
One to four values that specify the distance sliced into the image from its outer top, right, bottom, and left sides to create the image border. If fill is included, the central part of the border image is used as the element's background image. |
border-image |
<'border-image-source'> || <'border-image-slice'> [ / <'border-image-width'> | / <'border-image-width'<? / <'border-image- outset'> ]? || <'border-image-repeat'> |
Shorthand to specify multiplevalues for the border image. |
In the border-image shorthand, the URL for the image file, the width and the height that the border should slice into the image from its edges, and then how the border image should repeat.
![Home Sweet Home](/storage/rc-covers/10867-thumb.png)
The border image property is still not fully supported as a CSS standard, but is available in Firefox, Safari, Chrome, and Opera with the appropriate browser extensions:
Border Radius
Border radius allows for the inclusion of rounded corners. Although referred to as border radius, this property really rounds the corners of the box, whether there is a specific border on it or not. The radius can be a single value per corner for a circular radius or two values per corner for an elliptical radius. The border radius can be applied to all four corners or each individually as desired.
![radius](/storage/rc-covers/10868-thumb.png)
Property |
Syntax |
Description |
border-radius |
[ <length> | <percentage> ] {1,4} [ / [ <length> | <percentage> ]{1,4} ]? |
One to four values that specify the radius of the corners' curvature on each corner (top left, top right, bottom right, bottom left). Optionally, a slash (/) and one to four more values can be included to create elliptical curves on each of the four corners. |
border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius |
[ <length> | <percentage> ] [ / [ <length> | <percentage> ] ]? |
A single value that specifies the radius for a specific corner. |
![radius](/storage/rc-covers/10869-thumb.png)
![radius2](/storage/rc-covers/10870-thumb.png)
![radius3](/storage/rc-covers/10871-thumb.png)
![radius4](/storage/rc-covers/10872-thumb.png)
![Hot Tip](/storage/rc-covers/10873-thumb.png)
Content in rounded corners is not cropped
Border radius does not crop the content inside the box, so any image or text in a corner will still appear. However, it will crop the background — including background images — allowing you to create a variety of shapes, including circles and ovals.