Home > Common Problem > body text

css background code collection

zbt
Release: 2023-11-01 10:21:54
Original
2100 people have browsed it

css background code: 1. Background color, background-color: color-name;; 2. Background image, background-image: url('image-url');; 3. Background repetition, background- repeat: repeat-style;; 4. Background position, background-position: position-style; and so on.

css background code collection

CSS background code is as follows:

1. Background color:

background-color : color-name;

Where, color-name can be any valid CSS color name or hexadecimal color value.

2. Background image:

background-image: url('image-url');

Among them, image-url is the image URL address.

3. Background repeat:

background-repeat: repeat-style;

where repeat-style can be repeat, repeat-x or repeat-y, indicates whether the background image needs to be tiled or tiled in a specific direction.

4. Background position:

background-position: position-style;

Among them, position-style can be left, center or right, Indicates the position of the background image on the page.

5. Background size:

background-size: size-style;

Among them, size-style can be auto, cover or contain, Indicates the size of the background image.

6. Background attachment:

background-attachment: scroll-style;

where, scroll-style can be scroll, fixed or local-origin, indicates whether the background image scrolls with the page, is fixed above the page, or scrolls with the page.

7. Background color and image:

background: color-name url('image-url');

You can combine the background color and Set the background image together.

8. Background gradient:

background-image: linear-gradient(direction, color-stop1, color-stop2, ...);

Where, direction is the gradient direction, which can be to bottom, to top, to left, to right or round. color-stop It is the gradient color, there can be multiple, separated by commas.

The above is a complete collection of CSS background codes, which can be combined and used as needed.

The above is the detailed content of css background code collection. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!