模仿 Google 新搜索框的阴影效果

如图所示,注意搜索框的下边框右边框的简单阴影效果。一起到Google看看去!

 

模仿Google新搜索框的阴影效果

图片吗? 不是,Google是通过3个不同颜色的边框实现的简单阴影。

(注意:Google的效果不支持IE6,但是模仿的效果支持所有浏览器。)

Google是如何实现的?

模仿Google新搜索框的阴影效果


Google的主要HTML代码
<div class=ds>
<input class=lst size=57>
</div>
Google的主要CSS代码
.ds {
height:32px;
border-bottom:1px solid #e7e7e7;
border-right:1px solid #e7e7e7;
display:inline-block;
}
.lst {
height:25px;
margin:0px;
padding:5px 8px 0 6px;
border:1px solid #ccc;
border-bottom-color:#999;
border-right-color:#999;
}
查看Demo:点击这里

我的模仿效果

观察这篇文章的结尾处,或者到博客首页
如图所示,只有下边框有阴影,与我的博客阴影方向一致。

模仿Google新搜索框的阴影效果

 我的主要HTML代码

<div class=outer>
div_outer
<div class=inner>
div_innner
</div>
</div>

我的主要CSS代码

.outer {
width:400px;
border:1px solid #ccc;
border-bottom:2px solid #e7e7e7;
}
.inner {
height:20px;
line-height:20px;
width:360px;
margin-bottom:0px;
border-bottom:1px solid #ccc;
padding:10px 20px 15px 20px;
}

查看Demo:点这里

留念

这个效果看起来简单,实践起来也不难。但是要想到,并且做好,并不容易。

首先,需要两个容器,两个边框,不一定每个人都能想到。

然后,那几个边框的颜色和方向是很讲究的,要看起来像阴影,而且是正确的阴影。

最后,简单的东西常常不简单。

(完 2010年6月19日 晚)

出处:http://www.haoxiaoru.info/archives/560

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些