CSS for background picture stretching

Source: Internet
Author: User
Using the CSS3 property: Background-size

Background-size:cover can be stretched like a desktop wallpaper

Here are the explanations above:

Grammar
Background-size:length|percentage|cover|contain; Value Description
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 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.

The contain expands the image image to its maximum size so that its width and height are fully adapted to the content area.

  • 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.