css background position

來源:互聯網
上載者: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).

在CSS中如果使用像素設定背景位置,圖片的左上方則從指定的像素值開始顯示。如果使用百分比定位,則圖片與容器的指定百分比位置在同一點上。例如你設定背景上下左右位置都為20%,就相當於圖片的20%處作為起點定位於容器的20%處。(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.

這是個非常有用的,可以讓圖片與容器的指定位置重疊,定位在任意位置。

相關文章

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.