Background and Border Properties Flashcards
Shorthand property for setting all the background properties in one declaration
background
background: color image position/size repeat origin clip attachment initial | inherit;
I need to specify the position of a background image
[syntax and types of values]
The background-position property sets the starting position of a background image.
background-position: value;
words percent units initial inherit
I need to set whether this background image is fixed, or scrolls with the rest of the page.
[syntax and available values]
The background-attachment property sets whether a background image is fixed or scrolls with the rest of the page.
background-attachment:
scroll fixed local initial inherit;
background-position
[using words]
background-position: [left-right-center/top-center-bottom];
left top left center left bottom right top right center right bottom center top center center center bottom
background-position
[using %]
background-position: x% y%;
x% y%
The first value is the horizontal position and the second value is the vertical. The top left corner is 0% 0%. The right bottom corner is 100% 100%. If you only specify one value, the other value will be 50%. . Default value is: 0% 0%
background-position
[using units]
background-position: xpos ypos;
xpos ypos
The first value is the horizontal position and the second value is the vertical. The top left corner is 0 0. Units can be pixels (0px 0px) or any other CSS units. If you only specify one value, the other value will be 50%. You can mix % and positions
The background scrolls along with the element.
background-attachment: scroll;
The background is fixed with regard to the viewport
background-attachment: fixed;
The background scrolls along with the element’s contents
background-attachment: local;
I need to blend a specified background image with a gradient.
[syntax and available modes] CSS3
The background-blend-mode property defines the blending mode of each background layer (color and/or image).
background-blend-mode: normal multiply screen overlay darken lighten color-dodge saturation color luminosity;
I need to change the background color of this element
[syntax and options]
The background-color property sets the background color of an element.
The background of an element is the total size of the element, including padding and border (but not the margin).
background-color: color transparent (default) initial inherit;
I want to use an image for the background
background-image: url('URL') none initial inherit;
To specify more than one image, separate the URLs with a comma
I need to make the background repeat
[syntax and options]
The background-repeat property sets if/how a background image will be repeated.
By default, a background-image is repeated both vertically and horizontally.
Tip: The background image is placed according to the background-position property. If no background-position is specified, the image is always placed at the element’s top left corner.
background-repeat: repeat (default) repeat-x repeat-y no-repeat initial inherit;
Repeat the background image both vertically and horizontally.
background-repeat: repeat;
DEFAULT
Repeat the background image only horizontally.
background-repeat: repeat-x;
Repeat the background image only vertically.
background-repeat: repeat-y;
Keep the background image from repeating.
background-repeat: no-repeat;
I need to specify the painting area of the background relative to the box model
[syntax and options] CSS3
background-clip:
border-box padding-box content-box initial inherit;
Clip background to border box
background-clip: border-box;
DEFAULT
Clip background to padding box
background-clip: padding-box;
Clip background to content box
background-clip: content-box;
I need to specify where the background image is positioned relative to the box model
[syntax and options] CSS3
The background-origin property specifies where the background image is positioned.
Note: If the background-attachment property is set to “fixed”, this property has no effect.
background-origin: padding-box border-box content-box initial inherit;
Start the background image from the upper left corner of the padding edge
background-origin: padding-box;
Start the background image from the upper left corner of the border
background-origin: border-box;
Start the background image from the upper left corner of the content
background-origin: content-box;
I need to specify the size of a background image
[syntax and options] CSS3
The background-size property specifies the size of the background images.
background-size: auto length cover contain initial inherit;
Keep the background image’s width and height the same as the image
background-size: auto;
DEFAULT
Shorthand property for setting all of the border properties in one declaration
The border shorthand property sets all the border properties in one declaration.
It does not matter if one of the values below are missing, e.g. border:solid #ff0000; is allowed.
border: border-width border-style border-color initial | inherit;