Home > Web Front-end > CSS Tutorial > CSS Syntax Manual (5) Color and Background Properties

CSS Syntax Manual (5) Color and Background Properties

黄舟
Release: 2016-12-19 16:16:50
Original
1435 people have browsed it

1. color

Function: Set the color of the foreground or element.
Numerical: Use color keywords or RGB values.
Example:


Text color (keyword)

Text color (#rrggbb)

Text color [rgb(rr,gg,bb)]

Text color [rgb(r%,g%,b %)]

2. background-color

Function: Set the background color of the page or page element.
Value:
Color - Available color name or RGB value
transparent - Transparent, make the page background the default background.
Example:


Background color

3. background-image

Function: Define background graphics.
Value:
none - do not use graphics as background
url - provide the URL address of the graphics file
Note: You can also include the background-color attribute to use when the graphics cannot be found
Example:


Graphic background

4 , background-repeat

Function: Control whether the graphic background is repeated.
Value:
repeat - vertical and horizontal repeat, default value
repeat-x - horizontal repeat
repeat-y - vertical repeat
no-repeat - no repeat
Description: This attribute is together with the background-image and background-position attributes use.
Example:


Horizontal repeat arrangement

5. background-attachment

Function: Specify whether the background of the element scrolls with the element or is fixed at a certain position on the page.
Value:
scroll - scrolls with the element
fixed - fixed
Description:
The default value is scroll, this attribute is used together with the background-image attribute.

6. background-position

Function: Used to position the element background in space
Value:
Length - Set the starting point of the edge of the element box in relative or absolute units and give the coordinates in the unit.
Percentage - Used as a percentage to indicate the position on the edge of the box where the browser will start placing the image. This value can be repeated to also provide vertical and horizontal starting points
Vertical position - sets the starting point in the vertical direction, the keywords are top, center, bottom
Horizontal position - sets the starting point in the horizontal direction, the keywords left, center, right
For example: top left, left top and 0% 0% all mean that the upper left corner of the graphic starts from the upper left corner of the element box. Example:


Body {background-image:url(logo.gif); background-position:50% 50%}

This statement sets the Body basic class to the background graphic to be displayed in the center of the page.

7. background

Function: Abbreviation attribute, you can set all background attributes.

Values:
background-attachment
background-color
background-image
background-position
background-repeat
See the individual properties section for details on the above values.

The above is the content of CSS Grammar Manual (5) Color and Background Properties. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template