css div 邊框陰影利用背景圖或內(nèi)外層div實(shí)現(xiàn)層次感覺陰影效果
發(fā)布時(shí)間:2012-12-18 14:24:03 作者:佚名
我要評(píng)論

在網(wǎng)頁(yè)布局中偶爾會(huì)用到div 邊框陰影做一些特殊效果本文介紹兩種實(shí)現(xiàn)方法:一種是利用內(nèi)外層的div邊框來(lái)實(shí)例層次感覺的css邊框陰影效果,另一種是利用了背景圖片再加內(nèi)外div來(lái)實(shí)現(xiàn)的這種效果更漂亮,需要了解的朋友可以參考下
兩種實(shí)現(xiàn)方法一種是利用內(nèi)外層的div邊框來(lái)實(shí)例層次感覺的css邊框陰影效果,另一種是利用了背景圖片再加內(nèi)外div來(lái)實(shí)現(xiàn)的這種效果更漂亮。
簡(jiǎn)單一點(diǎn)的純css
<head>
<metahttp-equiv="content-type"content="text/html;charset=gb2312"/>
<title>cssdiv邊框陰影</title>
<styletype="text/css">
body{padding:200px;}
div{border-width:1px;border-style:solid;padding:1px;}
.a{background-color:#f3f3f3;border-color:#fbfbfb;}
.b{background-color:#d8d8d8;border-color:#e8e8e8;}
.c{background-color:#fff;border-color:#bbb;height:100px;color:#ff0000;}
</style>
</head>
<body>
<divclass="a">
<divclass="b">
<divclass="c">邊框?yàn)殛幱靶Ч?lt;/div>
</div>
</div>
</body>
</html>
復(fù)雜一點(diǎn)的利用圖片背景
<!doctypehtmlpublic"-//w3c//dtdxhtml1.0transitional//en""http://www.027eat.com/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<htmlxmlns="http://www.027eat.com/1999/xhtml">
<head>
<title>css邊框陰影</title>
<style>
.drops教程hadow2{
float:left;
clear:left;
background:url(http://www.6a8a.com/uploadfile/2011/0621/20110621015322996.png)no-repeatbottomright!important;
background:url(http://www.6a8a.com/uploadfile/2011/0621/20110621015329456.gif)no-repeatbottomright;
margin:10px010px10px!important;
margin:10px010px5px;
width:500px;
padding:0px;
}
.innerbox{
position:relative;
bottom:6px;
right:6px;
border:1pxsolid#999999;
padding:4px;
margin:0px0px0px0px;
}
.innerbox{
margin:0px0px-3px0px;
margin:0px0px0px0px;
}
.innerboxp{
font-size:14px;
margin:3px;
}
</style>
</head>
<body>
<divclass="dropshadow2"><divclass="innerbox"><h4>css陰影:</h4><p>這段邊框陰影效果怎么樣呢?</p></div></div>
</body>
</html>
簡(jiǎn)單一點(diǎn)的純css
復(fù)制代碼
代碼如下:<head>
<metahttp-equiv="content-type"content="text/html;charset=gb2312"/>
<title>cssdiv邊框陰影</title>
<styletype="text/css">
body{padding:200px;}
div{border-width:1px;border-style:solid;padding:1px;}
.a{background-color:#f3f3f3;border-color:#fbfbfb;}
.b{background-color:#d8d8d8;border-color:#e8e8e8;}
.c{background-color:#fff;border-color:#bbb;height:100px;color:#ff0000;}
</style>
</head>
<body>
<divclass="a">
<divclass="b">
<divclass="c">邊框?yàn)殛幱靶Ч?lt;/div>
</div>
</div>
</body>
</html>
復(fù)雜一點(diǎn)的利用圖片背景
復(fù)制代碼
代碼如下:<!doctypehtmlpublic"-//w3c//dtdxhtml1.0transitional//en""http://www.027eat.com/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<htmlxmlns="http://www.027eat.com/1999/xhtml">
<head>
<title>css邊框陰影</title>
<style>
.drops教程hadow2{
float:left;
clear:left;
background:url(http://www.6a8a.com/uploadfile/2011/0621/20110621015322996.png)no-repeatbottomright!important;
background:url(http://www.6a8a.com/uploadfile/2011/0621/20110621015329456.gif)no-repeatbottomright;
margin:10px010px10px!important;
margin:10px010px5px;
width:500px;
padding:0px;
}
.innerbox{
position:relative;
bottom:6px;
right:6px;
border:1pxsolid#999999;
padding:4px;
margin:0px0px0px0px;
}
.innerbox{
margin:0px0px-3px0px;
margin:0px0px0px0px;
}
.innerboxp{
font-size:14px;
margin:3px;
}
</style>
</head>
<body>
<divclass="dropshadow2"><divclass="innerbox"><h4>css陰影:</h4><p>這段邊框陰影效果怎么樣呢?</p></div></div>
</body>
</html>
相關(guān)文章
基于CSS 屬性實(shí)現(xiàn)按鈕懸停邊框和背景動(dòng)畫集合
這篇文章主要介紹了基于CSS 屬性實(shí)現(xiàn)按鈕懸停邊框和背景動(dòng)畫集合,需要的朋友可以參考下2019-05-09- 這篇文章主要介紹了CSS 制作帶邊框背景色透明的消息框的實(shí)例代碼,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2018-09-03
css3 邊框、背景、文本效果的實(shí)現(xiàn)代碼
這篇文章主要介紹了css3 邊框、背景、文本效果的實(shí)現(xiàn)代碼,需要的朋友可以參考下2018-03-21CSS3實(shí)現(xiàn)多背景模擬動(dòng)態(tài)邊框的效果
前幾天在工作的時(shí)候遇到一個(gè)問題,項(xiàng)目需要實(shí)現(xiàn)一個(gè)效果,當(dāng)鼠標(biāo)移入一個(gè)元素的時(shí)候,元素出現(xiàn)一個(gè)動(dòng)態(tài)的邊框,通過(guò)網(wǎng)上查找資料看到有人推薦可以使用Css3來(lái)實(shí)現(xiàn),后來(lái)試了2016-11-08CSS控制背景圖像平鋪實(shí)現(xiàn)邊框陰影效果
CSS控制背景圖像平鋪,從而實(shí)現(xiàn)區(qū)域邊框陰影的效果,可貴之處是本代碼不管你需要陰影的區(qū)域是多大,它都能自動(dòng)適應(yīng),個(gè)人感覺還不錯(cuò),具體實(shí)現(xiàn)如下建議收藏下哦2013-08-25css樣式div或li在ie6下背景平鋪及border邊框斷線解決技巧
css樣式div或li在ie6下背景平鋪或邊框斷線解決辦法2011-09-04- 網(wǎng)頁(yè)制作Webjx文章簡(jiǎn)介:到現(xiàn)在為止,只有一些已經(jīng)工作的CSS3特性. 到現(xiàn)在為止,只有一些已經(jīng)工作的特性,他們中的一些如下: 圓角 從web2.0開始,開2009-04-02
- 本文通過(guò)代碼給大家介紹css背景和邊框標(biāo)簽的一些知識(shí),通過(guò)相關(guān)屬性設(shè)置背景顏色,背景圖像,對(duì)css背景與邊框的相關(guān)知識(shí)感興趣的朋友一起看看吧2021-05-21