CSS Grammar Handbook (v) color and background properties

Source: Internet
Author: User
1. Color

Function: Sets the color of the foreground or element.
Numeric: Use a color keyword or an RGB value.
Example:


Text color (keywords)

Text color (#rrggbb)

Text color [RGB (RR,GG,BB)]

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

2, Background-color

Function: Sets the background color of the page or page element.
Numerical:
Colors-Available color names or RGB values
Transparent-transparent to make the page background the default background.
Example:


Background color

3, Background-image

Function: Defines the background graphic.
Numerical:
None-no graphics for background
URL-provides the URL address of the graphics file
Description: You can also include the Background-color property in order to find the graphics era
Example:


Graphic background

4, Background-repeat

Function: Controls whether the graphic background is repeated.
Numerical:
Repeat-vertical and horizontal repetition, default value
Repeat-x-Horizontal Repetition
Repeat-y-Vertical Repetition
No-repeat-No repetition
Description: This property is used with the Background-image and Background-position properties.
Example:


Horizontal repeating arrangement

5, Background-attachment

Function: Specifies whether the background of the element is scrolled along with the element or fixed at a location on the page.
Numerical:
Scroll-Scrolls with elements
Fixed-stationary
Description
The default value is scroll, which is used with the Background-image property.

6, Background-position

function: Used to position the element background in space
Numerical:
Length-relative or absolute units set the starting point of the edge of the element box and give the coordinates under the unit.
Percent-represents the position of the browser starting to place the graph on the edge of the box. Can repeat this value also provides vertical and horizontal starting points
Vertical position-Sets the starting point of the vertical direction, the keyword is top, center, bottom
Horizontal position-Sets the starting point of the horizontal direction, the keyword left, center, right
For example: Top left with left top and 0% 0% all indicate that the upper right corner of the graph starts from the upper-right corner of the element box
Example:


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

This statement sets the Body base class as the background graphic to be centered on the page.

7, background

Features: Shorthand property, you can set all background properties.
Numerical:
Background-attachment
Background-color
Background-image
Background-position
Background-repeat
For details on the above values, see the individual Attributes section.

The above is the CSS Grammar Manual (v) color and background properties of the content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.