Tutorial by Examples

The background-color property sets the background color of an element using a color value or through keywords, such as transparent, inherit or initial. transparent, specifies that the background color should be transparent. This is default. inherit, inherits this property from its parent e...
The background-image property is used to specify a background image to be applied to all matched elements. By default, this image is tiled to cover the entire element, excluding margin. .myClass { background-image: url('/path/to/image.jpg'); } To use multiple images as background-image, defi...
Gradients are new image types, added in CSS3. As an image, gradients are set with the background-image property, or the background shorthand. There are two types of gradient functions, linear and radial. Each type has a non-repeating variant and a repeating variant: linear-gradient() repeating-...
The background property can be used to set one or more background related properties: ValueDescriptionCSS Ver.background-imageBackground image to use1+background-colorBackground color to apply1+background-positionBackground image's position1+background-sizeBackground image's size3+background-repeat...
The background-position property is used to specify the starting position for a background image or gradient .myClass { background-image: url('path/to/image.jpg'); background-position: 50% 50%; } The position is set using an X and Y co-ordinate and be set using any of the units used withi...
The background-attachment property sets whether a background image is fixed or scrolls with the rest of the page. body { background-image: url('img.jpg'); background-attachment: fixed; } ValueDescriptionscrollThe background scrolls along with the element. This is default.fixedThe backgro...
The background-repeat property sets if/how a background image will be repeated. By default, a background-image is repeated both vertically and horizontally. div { background-image: url("img.jpg"); background-repeat: repeat-y; } Here's how a background-repeat: repeat-y looks lik...
If you set opacity on an element it will affect all its child elements. To set an opacity just on the background of an element you will have to use RGBA colors. Following example will have a black background with 0.6 opacity. /* Fallback for web browsers that don't support RGBa */ background-color...
In CSS3, we can stack multiple background in the same element. #mydiv { background-image: url(img_1.png), /* top image */ url(img_2.png), /* middle image */ url(img_3.png); /* bottom image */ background-position: right bottom, ...
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. Default value: padding-box Possible values: padding-box - The position is relative to the padding box border-box - The p...
Definition and Usage: The background-clip property specifies the painting area of the background. Default value: border-box Values border-box is the default value. This allows the background to extend all the way to the outside edge of the element's border. padding-box clips the background at ...
General overview The background-size property enables one to control the scaling of the background-image. It takes up to two values, which determine the scale/size of the resulting image in vertical and and horizontal direction. If the property is missing, its deemed auto in both width and height....
.my-div { width: 300px; height: 200px; background-size: 100%; background-repeat: no-repeat; background-image: linear-gradient(to right, black 0%,white 100%), url('https://static.pexels.com/photos/54624/strawberry-fruit-red-sweet-54624-medium.jpeg'); background-blend-mod...

Page 1 of 1