CSS background position

Source: Internet
Author: User

If you set a background position using pixels, the top-left corner of the image is positioned from the top-left corner of the element by the specified number of pixels. with percentage positioning, It is the corresponding point on the image that gets positioned. so if you set a vertical and horizontal position of 20 percent, you are actually positioning a point 20 percent from the top left of the image, 20 percent from the top left of the parent element (see figure 7-14 ).

In CSS, if you use pixels to set the background position, the upper left corner of the image is displayed starting from the specified pixel value. If percent positioning is used, the image and the container are located at the same point. For example, if you set both the upper and lower sides of the background to 20%, it is equivalent to 20% of the image as the starting point and located at 20% of the container. (7-14)

This is very useful as it allows you to create background images with the same horizontal proportions as your layout, and then position them where you want the columns to appear.

This is very useful. It allows the image to overlap with the specified position of the container and locate the image at any position.

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.