CSS3 implements a grid background, background-image,background-size

Source: Internet
Author: User

Using pure CSS3 to realize the grid background, what should be done?

You need to set the Background-image,background-size property to the container

. Container {            background-image:
Linear-gradient (RGBA (0, 0, 0.15) 10%, Rgba (0, 0, 0, 0) 10%); background-size: 10px 10px; width: 600px; height: 300px; }

The Background-image property sets the background image for the element.

The background of an element occupies the full dimensions of the element, including padding and borders, but excluding margins.

By default, the background image is in the upper-left corner of the element and repeats in both horizontal and vertical directions.

Background-size Specify the size of the background image

The general values are:

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: Expands the image image to the maximum size so that its width and height are fully adapted to the content area.

View Demo: HTTP://RUNJS.CN/DETAIL/GIPGR9QH

CSS3 implements a grid background, background-image,background-size

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.