How to auto Scale Image Shadow: shrink-wraps

Source: Internet
Author: User
Tags scale image
First, let's look at a simple example:

Test 1

HTML code:

1 <Div style = "background-color: Gray;"> Test 1 </div>

 

Now we add the float attribute to CSS in the above example, and you will find some small changes. Maybe you think this is okay, the theme to be discussed today is derived from this small change;

Test 2

HTML code:

1 <Div style = "background-color: Gray; float: Left;"> Test 2 </div>

 

Now you can see that the DIV in Test 2 is automatically scaled as your content increases. Ah, yes... what is the effect of applying this effect to the background shadow?

1. You do not need to set a fixed width for the DIV of the package.

2. Automatic Adjustment Based on the image size

Abstract: CSS mastery

CSS code:

1. IMG-wrapper {}{
2 Background: URL (images/shadow.gif) No-repeat bottom right;
3 clear: both;
4 float: left;
5 position: relative;
6 margin: 10px 0 0 10px;
7}
8
9. IMG-wrapper IMG {}{
10 background-color: # FFF;
11 border: 1px solid # a9a9a9;
12 padding: 4px;
13 display: block;
14 margin:-5px 5px 5px-5px;
15 position: relative;
16} HTML code:

1 <Div class = "IMG-wrapper"> </ div>

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.