About CSS Background Background Properties Classic configuration

Source: Internet
Author: User

Background

Background-color:transparent;background-image:url ("/assets/images/phonetitle1.gif"); background-repeat:repeat; background-attachment:scroll;background-position:0% 0%;background-clip:border-box;background-origin:padding-box ; Background-size:auto Auto;

1, Background-color:transparent;

Set the background color of an element

property to set a solid color for the element. This color fills the element's content, padding, and border areas, extending to the outer bounds of the element's border (but excluding margins). If the border has a transparent part (such as a dashed border), the background color is displayed through these transparent sections.

Although in most cases, it is not necessary to use transparent. However, setting the transparent value is necessary if you do not want an element to have a background color and you do not want your design to be affected by the user's color settings on the browser.

2,background-image:url ("/assets/images/phonetitle1.gif");

3, Background-repeat:repeat;

4, Background-attachment:scroll;

property to set whether the background image is fixed or scrolls along with the rest of the page.

Scroll The default value. The background image moves as you scroll through the rest of the page.
Fixed The background image does not move when the rest of the page scrolls.
Inherit Specifies that the settings for the Background-attachment property should be inherited from the parent element.

5, background-position:0% 0%;

Sets the starting position of the background image.

  • Top left
  • Top Center
  • Top Right
  • Center left
  • Center Center
  • Center Right
  • Bottom Left
  • Bottom Center
  • Bottom right

If you specify only one keyword, then the second value will be "center".

Default value: 0% 0%.

X y%

The first value is a horizontal position, and the second value is the vertical position.

The upper-left corner is 0% 0%. The lower right corner is 100% 100%.

If you specify only one value, the other value will be 50%.

Xpos ypos

The first value is a horizontal position, and the second value is the vertical position.

The upper-left corner is 0 0. Units are pixels (0px 0px) or any other CSS unit.

If you specify only one value, the other value will be 50%.

You can mix the% and position values.

6,Background-clip:border-box;

The drawing area of the background.

The background is cropped to the bounding box. Border-box

The background is cropped to the inner margin box. Padding-box

The background is cropped to the content box. Content-box

7,Background-origin:padding-box;

  

8, Background-size:auto Auto;

Specifies the size of the background image.

Length| percentage|cover|contain;

Length

Sets the height and width of the background image.

The first value sets the width, and the second value sets the height.

If you set only one value, the second value is set to "Auto".

Percentage

Sets the width and height of the background image as a percentage of the parent element.

The first value sets the width, and the second value sets the height.

If you set only one value, the second value is set to "Auto".

Cover

Expand the background image to be large enough to allow the background image to completely cover the background area.

Some parts of the background image may not appear in the background positioning area.

Contain Extend the image image to the maximum size so that its width and height are fully adapted to the content area.

About CSS Background Background Properties Classic configuration

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.