css2--background

Source: Internet
Author: User

# # CSS2 Background
##### background-color Setting the background color

##### Background-image Set Background image
-"'" Background-image:url ("Path of the picture");

##### Background-repeat to set the repeating way of the background picture

-Repeat default value. Causes the background picture to repeat in two directions horizontally and vertically. To fill the elements
-Repeat-x Horizontal Direction repeat
-Repeat-y Vertical Direction repeat
-No-repeat pictures are not duplicated

##### background-position Setting the background picture display location
-The default background picture is displayed from the upper left corner.
-Setting Mode:
1. Set the position of the background picture by the keyword of the position
-Left top right bottom center
-Set the picture position using these keyword 22 combinations
-If only one keyword is set, the second default is center
2. You can specify a horizontal and vertical offset to set the picture position
-Background-position:x offset y offset
-X Offset: Positive value moves right; negative value moves left
-Y offset: positive value moves downward;

##### Background-attachment Set whether the background picture scrolls with the screen

-Scroll default value. The background will scroll with the screen
-Fixed position relative to the window. does not scroll with the screen
-Usage Scenario: The overall background of the Web page

##### background Shorthand
-All background-related styles can be set at the same time
-there is no requirement for the order and number of styles to be written
-Multiple background images can be separated by commas
-"' background:red url () no-repeat top Center"

##### img tags and background-image differences
1. Use the IMG element to introduce pictures, images and Web pages to load synchronously, if the page is too large, affecting the page loading speed

-Use IMG Scene: Important page picture element. For example, website logo, product image

2. Use the background map to introduce images, after the page is loaded, or loaded with the Web page. Does not affect page loading speed

-Scenes with background images: Non-essential page picture elements, such as small images

css2--background

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.