Background with content auto-scaling with CSS3 time limit

Source: Internet
Author: User
CSS3 brings us a very useful new property: Border-image, we can make use of this property to create a background that automatically scales as content increases or decreases. Nonsense not much to say, look at the code!
Html:
<ol> <li>第一条列表内容</li> <li>第二条列表内容</li> <li>第三条列表内容</li> <li>第四条列表内容</li> <li>第五条列表内容</li> </ol>
Css:
border: 20px solid; width: 200px; -webkit-border-image: url(border.png) 30 30 round;

Now let's add the list entry to see:

As the number of lists increases, the background automatically becomes larger, very good!
This is border.png:

You may have questions about 30 30 in Border-image:
-webkit-border-image: url(border.png) 30 30 round;
See:

Above the border-image in the two values, the personal understanding is that the first to show the picture up and down from the edge of the "eat" into how many pixels as a border, corresponding to the second value represents about. The rest of the middle area will be repeated (or stretched) as the background.
You may also have a question about the size of the stroke:border: 20px solid;
Let's see what the stroke looks like when it's 50 pixels:

So now you get it.
As for the color of the stroke, because it will not be displayed, so it doesn't matter whether it is written or not.
Well, now that you know how to make this with content auto-scaling background, you can go to practice!

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.