CSS-CSS background

Source: Internet
Author: User

CSS allows you to apply a solid color as a background, and also allows you to create fairly complex effects using a background image

One: Background color Background-color Property
p {background-color:gray;}
II: Background Image Background-image Properties
Body {background-image:url (/i/eg_bg_04.gif);}
Three: Background repeating background-repeat property

The property value repeat causes the image to be tiled horizontally vertically, just as usual with previous background images.

Repeat-x and repeat-y respectively cause the image to repeat only horizontally or vertically,

No-repeat does not allow images to be tiled in any direction

  

Body  {   background-image:url (/i/eg_bg_03.gif);  background-repeat:repeat-y;  }
Four: Background positioning background-position Properties

There are many ways to provide a value for the Background-position property. First, you can use some keywords: top, bottom, left, right, and center. Usually, these keywords will appear in pairs, but not always. You can also use length values, such as 100px or 5cm, and finally you can use a percentage value. Different types of values for background image placement slightly different

Body  {     background-image:url ('/i/eg_bg_03.gif ');    Background-repeat:no-repeat;    Background-position:center;  }
V: Background Association Background-attachment property
Body   {  background-image:url (/i/eg_bg_02.gif);  Background-repeat:no-repeat;  Background-attachment:fixed  }

CSS-CSS background

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.