Background-position Detailed Usage

Source: Internet
Author: User

1,background-position:0 0; equals background-position:left top; (upper left corner)

2,background-position:100% 100%; equals background-position:right bottom; (lower right corner)

3,background-position:-70px-40px; (with 0 0 point coordinates at the top left, offset 70px to the left, offset up to 40px)

4,background-position:70px 40px; (0 0 point coordinate in upper left corner, offset 70px to the right, offset 40px downward)

5,background-position:50% 50%; equals Background-position:center Center; (Center display)

background-position:-50%-50%;

is equivalent to the width of the x:-{container (container)-the width of the background picture is}*x percent, and the excess portion is hidden.
is equivalent to the height of the y:-{container (container)-the height of the background image is}*y percent, and the excess portion is hidden.

6. Description:
Sets or retrieves the background image position of the object. You must first specify the Background-image property.
This property location is not affected by the object's patch properties (padding) setting.
The default value is: 0% 0%. The background picture is positioned in the upper-left corner of the content area where the object does not include patches (padding).
If only one value is specified, the value is used for the horizontal axis. The ordinate will default to 50%. If two values are specified, the second value is used for the ordinate.
If you set the value to right center, the background image will be positioned on the left side because the center value will be overwritten with the axis value.
The corresponding script attribute is backgroundposition.

Background-position Detailed Usage

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.