点评:一般我们可以使用背景图的方式给图片添加阴影,但对于不固定尺寸的图片如何实现呢?我们可以采取“视觉欺骗大法”——定义渐变边框来实现:
[code]
<!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; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<title></title>
<style type="text/css" >
body {background:#2e334d;}
img {border:none;}
a.pic-shadow {display:inline-block;zoom:1;padding:1px;background:#262a3f;border:solid #2b3048 1px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;}
a.pic-shadow img {padding:1px;background:#13151f;border:solid #1e2132 1px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;}
</style>
</head>
<body>
<a class="pic-shadow" href="#" title=""><img src="http://www.jb51.net/do/uploads/allimg/090711/1911220.png" alt="" title="" /></a>
</body>
</html>
提示:您可以先修改部分代码再运行
下面这段定义是各标准浏览器中圆角定义,用以更专业地欺骗眼睛
复制代码代码如下:
延伸阅读
- 2011-5-18-- css3圆角,12款有助于简化CSS3开发的工具
- 2010-12-9-- css3圆角,用CSS3将你的设计带入下个高度
- 2010-12-9-- css3圆角,利用CSS3的定位页面元素
- 2010-12-9-- css3圆角,CSS3 优势以及网页设计师如何使用CSS3技术
- 2010-12-9-- css3圆角,CSS3中的5个有趣的新技术
- 2010-12-9-- css3圆角,CSS3 box-sizing属性
- 2010-12-9-- css3圆角,CSS3五个技巧给你的网站带来出色的效果
- 2011-5-21-- css3圆角,20 个令人惊叹的 CSS3 文本效果
- 2010-12-9-- css3圆角,CSS3 please 跨浏览器的CSS3产生器
- 2010-12-9-- css3圆角,CSS3 简单又实用的5个属性
最新评论