CSS for Background Image Positioning

Source: Internet
Author: User

Background-position:
| [Percentage | length] {1, 2}
| [Top | center | bottom]
| [Left | center | right] www.86oo.com

Background-position: [percentage | length] is defined by X (X) y (y), such as background-position: 20px 40px; http://www.86oo.com

Background-position: [top | center | bottom] and [left | center | right] have the same meaning, and any two of them can have different effects.
It can be background-position: top center; center bottom; top bottom; left, right .....

Www.86oo.com

Bottom: bottom, top: top, left: left, right: right, center: Middle.

Www.86oo.com

The following is a comparison between pixels and English:
Top left = left top = 0% 0%
Top = top center = centers top = 50% 0%
Right top = top right = 100% 0%
Left = left center = center left = 0% 50%
Center = 50% 50%
Right = right center = center right = 100% 50%
Bottom left = left bottom = 0% 100%
Bottom = bottom center = center bottom = 50% 100%
Bottom right = right center = 100% 100%

86oo tutorial

Background can be used to fill the background color and background image of a specified layer. The format is as follows:

86oo.com

Background: # ccc url('bg.gif ') top left no-repeat;
Fill the entire layer with #ccc(grayscale) and use bg.gif as the background image,
Top left indicates that the image is located at the top left of the current layer, and no-repeat indicates that only the image size is displayed without filling the entire layer.
Top/right/left/bottom/center is used to locate the background image, indicating the top/right/bottom/left/center;

86oo.com provides various tutorials

Background: url('bg.gif ') 20px 100px;
The X coordinate is 20 pixels, And the Y coordinate is 100 pixels;

86oo.com

Repeat/no-repeat/repeat-x/repeat-y
Fill the entire layer/not fill/fill along the X axis/fill along the Y axis respectively.

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.