How does CSS background-image tile?

Source: Internet
Author: User
Tags set background
Before the layout of the page, a DIV can only set a background image, set multiple backgrounds, to use multiple div nesting to achieve, so compatibility is better. This method is recommended if your website requires a browser-compatible version. The advent of CSS3 solves the problem that a DIV can only set a background, allowing a div to set multiple background images. Background-image can also set linear gradients, and so on.

About CSS3 's background, the function is very powerful, has many properties, like Background-size and so on, these attributes can write a blog to tell. About the other properties of Css3background, a blog will be later to tell the individual!

Css3/css1 Background-image Properties

Grammar:

background-image:<bg-image> [, <bg-image>]*<bg-image> = none | <url> | <linear-gradient> | <radial-gradient> | <repeating-linear-gradient> | <repeating-radial-gradient>

Default value: None

Value:

None: No background map.

< URL: Use an absolute or relative address to specify the background image.

< Linear-gradient>: Creates a background image with a linear gradient. (CSS3)

< Radial-gradient>: Creates a background image using a radial (radioactive) gradient. (CSS3)

< Repeating-linear-gradient>: Creates a background image with a repeating linear gradient. (CSS3)

< repeating-radial-gradient>: Create a background image with a repeating radial (radioactive) gradient. (CSS3)

Description

Sets or retrieves the background image of an object.

If Background-image is set, it is also recommended that the author set Background-color to maintain a certain contrast with the text when the background image is not visible.

The corresponding script attribute is backgroundimage.

How to set the drawing background picture to fill the screen in CSS

The CSS code I wrote is

#bg {width:100%;height:100%;background:url (images/beijing.png);}

In this way he would repeat the picture overlay screen, I want to let him stretch the picture to fill the screen, how should write?

Background:url (images/beijing.png) repeat;


Add a genus

Background-size:100%;background:url (images/beijing.png) no-repeat;

Plus a genus Background-size:100%;background:url (images/beijing.png) no-repeat; The picture will be distorted Oh!

Either the frame limit, are set to 100%, I test here is covered, you see if there are other attributes affected.

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.