CSS syntax manual 5 color and background attributes

Source: Internet
Author: User
Tags manual repetition

1. color
Function: sets the color of the foreground or element.
Value: use the color keyword or RGB value.
Example:
Text color (keyword)
Text color (# rrggbb)
Text color [rgb (rr, gg, bb)]
Text color [rgb (r %, g %, B %)]
2. background-color
Function: sets the background color of a page or page element.
Value:
Color-available color name or RGB value
Transparent-transparent, making the page background the default background.
Example:
Background color
3. background-image
Function: defines the background image.
Value:
None-no image as background
Url-provide the URL of the graphic file
Note: the background-color attribute can also be used when no image is found.
Example:
Graphic background
4. background-repeat
Function: controls whether the graphic backgrounds are arranged repeatedly.
Value:
Repeat-vertical and horizontal repetition, default value
Repeat-x-horizontal repetition
Repeat-y-vertical repetition
No-repeat-no duplicates
Note: This attribute is used with the background-image and background-position attributes.
Example:
Horizontal repeat
5. background-attachment
Function: specifies whether the background of an element is scrolled along with the element or fixed to a certain position on the page.
Value:
Scroll-scroll with elements
Fixed-fixed
Note:
The default value is scroll. This attribute is used with the background-image attribute.
6. background-position
Function: used to locate the element background in a space.
Value:
Length-set the start point of the edge of the element frame in relative or absolute units, and give the coordinates under the unit.
Percentage-percentage indicates the position where the browser starts to show the image on the edge of the box. You can repeat this value to provide the vertical and horizontal start points.
Vertical position-set the start point of the vertical direction. The keyword is top, center, and bottom.
Horizontal position-set the start point of the horizontal direction. The keywords are left, center, and right.
For example, both top left, left top, and 0% 0% indicate that the upper left corner of the graph 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 basic class of the Body to center the background image on the page.
7. background
Function: abbreviation attribute. You can set all background attributes.
Value:
Background-attachment
Background-color
Background-image
Background-position
Background-repeat

Related Article

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.