|
|
|
|
|
前文介紹了《css ribbons(3D帶狀)設計,適合標題使用》,本文將繼續(xù)介紹css ribbons如何實現(xiàn)漸變色帶的樣式。
CSS-Ribbons 漸變色帶樣式
本文介紹的色帶有兩種,分別是從左到右漸變,和從右到左漸變。
CSS代碼
h2.ribbon {
font-size: 1em;
position: relative;
color: #222;
text-shadow: 0 1px rgba(255,255,255,.8);
background-color: #ccc;
}
h2.ribbon:before, h2.ribbon:after {
border-style: solid;
border-color: transparent;
bottom: -6px;
}
h2.ribbon_left {
margin: 0 -20px 30px -26px;
padding: 10px 0 10px 30px;
background-image: -moz-linear-gradient(left,rgba(255,255,255,0), #fff);
background-image: -webkit-linear-gradient(left,rgba(255,255,255,0), #fff);
background-image: -o-linear-gradient(left,rgba(255,255,255,0), #fff);
background-image: -ms-linear-gradient(left,rgba(255,255,255,0), #fff);
background-image: linear-gradient(left,rgba(255,255,255,0), #fff);
}
html代碼
<h2 class="ribbon ribbon_left">卡卡網(wǎng)簡介</h2>
使用說明
使用h2
元素,并為其添加一個類class="ribbon ribbon_left"
。
CSS代碼
h2.ribbon {
font-size: 1em;
position: relative;
color: #222;
text-shadow: 0 1px rgba(255,255,255,.8);
background-color: #ccc;
}
h2.ribbon:before, h2.ribbon:after {
border-style: solid;
border-color: transparent;
bottom: -6px;
}
h2.ribbon_right {
text-align: right;
margin: 0 -26px 30px -20px;
padding: 10px 30px 10px 0;
background-image: -moz-linear-gradient(left,#fff, rgba(255,255,255,0));
background-image: -webkit-linear-gradient(left,#fff, rgba(255,255,255,0));
background-image: -o-linear-gradient(left,#fff, rgba(255,255,255,0));
background-image: -ms-linear-gradient(left,#fff, rgba(255,255,255,0));
background-image: linear-gradient(left,#fff, rgba(255,255,255,0));
}
h2.ribbon_right:after {
border-width: 0 0 6px 6px;
border-left-color: #555;
right: 0;
}
html代碼
<h2 class="ribbon ribbon_right">網(wǎng)站發(fā)展歷史</h2>
使用說明
使用h2
元素,并為其添加一個類class="ribbon ribbon_right"
。