CSS Projection Implementation method

Source: Internet
Author: User

Spare Material:

1.png

Shadow.png

The first way: the use of negative margins to achieve

Eventually:

  

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <Metaname= "Viewport"content= "Width=device-width, initial-scale=1, maximum-scale=1, User-scalable=no">    <title>Using Backgrounds to achieve shadows</title></Head><Body>    <Divclass= "Image_warpper">            <imgsrc= "1.jpg"width:200px; height:200px;/>    </Div></Body></HTML>

  Image_warpper  { float : left ;  background : url (" shadow.png ") no-repeat bot        Tom right ; } { Background: #fff ;  padding : 4px ;  margin :  -4px 4px 4px-4px ;  Vertical-align :  bottom ;  border : 1px solid #eee ; }    

The second way, instead of using a negative margin, is to use the Position:relative property

  

. Image_warpper{float: Left;background:URL ("shadow.png") No-repeat bottom Right; }. Image_warpper img{background:#fff;padding:4px;position:relative;vertical-align:Bottom;Border:1px solid #ccc;Top:-4px; Left:-4px; }

The effect is as follows:

The Third Way: Css3-box-shadow

Incidentally review its syntax:

      

  

  Image_warpper  { float : left ;  background : url (" shadow.png ") no-repeat bot        Tom right ; } { Background-colo R :  #fff ;  padding : 4px ;  Vertical-align :  bottom ;  border : 1px solid #ccc ;  Box-shadow :  4px 4px #ccc ; }    

This property is currently supported by modern browsers: Ie9+, Firefox 4, Chrome, Opera, and Safari 5.1.1 support Box-shadow properties.

CSS Projection Implementation method

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.