Use CSS sliding door technology to add shadow effects to images

Source: Internet
Author: User

Adding a shadow to an image can make the image look much more refined. In image processing software, adding shadow effects to images is very easy to implement. However, if you need to use software to process each image, it is obviously very annoying, in addition, if you need to remove the watermark one day, you have to re-process the image. The following describes how to implement the shadow effect through CSS without changing the image itself. This method was invented by Mexican designer Sergio Villarreal in 2004.
General method,CodeExample:

 <!  Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"  >  <  Html  Xmlns  = "Http://www.w3.org/1999/xhtml"  >  <  Head >  <  Meta  HTTP-equiv  = "Content-Type"  Content  = "Text/html; charsets = UTF-8"   />  <  Title  > Head Line </  Title  >  <  Style Type  = "Text/CSS"  >  . Shadow  {  Float  :  Left  ;  Background  :  URL (images/bottom-right.gif) No-repeat bottom right ;  }  . Shadow Div  {  Background  :  URL (images/top-left.png) No-repeat  ;  Padding  :  0 4px 4px 0 ;  }  . Shadow img  {  Border  :  1px solid #000  ;  }  </  Style  >  <! -- [If GTE ie 5.5000]> <style type = "text/CSS">. shadow Div {filter: progid: DXImageTransform. microsoft. alphaimageloader (src = "images/top-left.png", sizingmethod = 'crop'); width: 1px; Background: None ;}</style> <! [Endif]  -->  </  Head  >  <  Body  >  <  Div  Class  = "Shadow"  >  < Div  > <  IMG  SRC  = "Cup.gif"  /> </  Div  >  </  Div  >  </  Body  >  </  Html  > 

 

Material download: http://files.cnblogs.com/likebeta/201205292522859.zip

 

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.