不用背景图也可实现图片阴影,只可惜只支持标准浏览器,ie6是被pass掉的,ieTester下7也没效果。请用火狐或Opera浏览。不过算是个小小的研究,开拓下思维。
代码已经压缩作为附件。效果截图如下:

主要代码:
<!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>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<style type="text/css">
body {
font-size:62.5%;
}
p {position:relative;padding:0;margin:0;font-size:14em;font-weight:bold;color:#fff;text-shadow:#333 5px 5px 10px;}
img {position:absolute;left:20px;top:20px;}
</style>
</head>
<body>
<p>□
<img src="kitty.jpg" alt="" />
</p>
</body>
</html>
本文介绍了一种不依赖背景图实现图片阴影的方法,仅通过CSS样式即可完成,适用于标准浏览器。文中提供了一个示例代码及截图,展示了如何利用text-shadow属性为图片添加阴影。
999

被折叠的 条评论
为什么被折叠?



