What are the background-related properties in CSS? Introduction to CSS Background properties

Source: Internet
Author: User
Tags set background

What are the relevant properties of the CSS background? The following article for you to bring about the CSS background properties of the introduction, there is a certain reference value, there is a need for friends to refer to, I hope you have some help.

1, CSS background properties for the content set background color: Background-color;
Property:
Color
Inherit; inherit a parent style

Box.html

<!doctype html>

Box.css

body{    background-color: #123456;}

2, CSS background properties for the content set background for the picture Background-image:url ();
Box.css

body{    background-color: #123456;        Background-image:url (image.png);    }

3, CSS Background properties of the fixed background image background-attachment
(using the Background-attachment property in CSS allows you to pin the picture to the browser, and if you drag the scroll bar, the background picture does not scroll as the page content scrolls, like text floating on the image)
Property value:
Scroll; background picture scrolls with content, default value
Fixed Background picture fixed, not scrolling with content
Inherit; inherit the parent class style

Box.css

body{    background-color: #123456;        Background-image:url (image.png);        background-attachment:fixed;        font-size:45px;    }

4, CSS background properties of the background image tile background-repeat;
Property value:
Repeat; tile background picture; default
No-repeat; a picture of uneven paving;
repeat-x; tile in horizontal direction
repert-y; tile in vertical direction

Box.css

body{     background-color: #123456;         Background-image:url (image.png);         background-attachment:fixed;         font-size:45px;         background-repeat:repeat-y;    }

5. Background image of CSS background background-position
Property value:
Top;
Center;
bottom; bottom
right;
Left;
Inherit; inherit the parent class style
Style:
Xxxpx,xxxpx;
xxx%,xxx%;
Xxxpx,top;

Box.css

body{    background-color: #123456;        Background-image:url (image.png);        background-attachment:fixed;        font-size:45px;        Background-repeat:no-repeat;        Background-position:left;    }
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.