css给容器和图片添加阴影效果

wumei2009-10-31 17:05:10

这是一个没有用图片做的阴影效果,它可以应用于任何容器元素,可以通过css设置成任何阴影颜色和阴影位置。

如果是图像,应该给shadowcontainer一个明确的宽度和高度来适合图片。

Some title
Some text here. Some text here.
Some text here. Some text here.
Some text here. Some text here.
Some text here. Some text here.
 

 

freeren css阴影效果

css代码

<style type="text/css">
<!--
.shiftcontainer2{
position: relative;
left: 5px; /*Number should match -left shadow depth below*/
top: 5px; /*Number should match -top shadow depth below*/
}

.shadowcontainer2{
width: 265px; /* container width*/
background-color: #d1cfd0;
}

.shadowcontainer2 .innerdiv2{
/* Add container height here if desired */
background-color: white;
border: 1px solid gray;
padding: 6px;
position: relative;
left: -5px; /*shadow depth*/
top: -5px; /*shadow depth*/
}
-->
</style>

xhtml

<div class="shiftcontainer2">
<div class="shadowcontainer2">
<div class="innerdiv2" >

Some title<br />
Some text here. Some text here.<br />
Some text here. Some text here.<br />
Some text here. Some text here.<br />
Some text here. Some text here.

</div>
</div>
</div>

您可能会对以下文章感兴趣:

精通CSS-来自Clagnut的阴影方法

精通CSS-洋葱皮阴影

精通CSS-简单的CSS阴影

精通CSS-模糊阴影

精通CSS-山顶角

上一篇:关于if条件注释 <!--[if IE]> <!--[if !IE]>
下一篇:一个tableless的CSS表单设计

  • >> more看看其他人的看法
  • 您好!你介意我分享您的博客,与我的MySpace组吗?有一个伙计,我认为会真的很喜欢你的内容很多。请让我知道。谢谢

  • 1 loans payday 2012-1-12 07:11 Thursday
  • }
  • 嘿只是想给你一个快速的抬起头来。在您的文章的话似乎是运行在IE浏览器的屏幕。我不知道如果这是一个格式的问题或事做浏览器的兼容性,但我想我会后,让你知道。虽然设计和风格很好看!希望你能尽快解决的问题。荣誉

  • 2 search engine optimization vancouver 2012-1-13 13:00 Friday
  • }
  • 你介意我引用了您的文章数,只要为我提供信贷和来源回你的网站?我的博客网站是在你和我的游客将真正从中受益很多您在这里所提供的信息相同的确切利基。请让我知道如果这与你没事吧。多谢了!

  • 3 oh canada 2012-1-20 23:04 Friday
  • }

有什么想说的吗?