Chapter 4 背景圖像

4.2圓角框

4.2.1傳統(tǒng)方法

1.上下兩個圓角
2.上下兩個圓角,中間長矩形repeat-y
<pre>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<style type="text/css">
.box{
width:424px;
background:url(images/tile2.gif) repeat-y;
}
.box h2{
background: url(images/top2.gif) no-repeat left top;
}
.box .last{
background: url(images/bottom2.gif) no-repeat left bottom;
padding-bottom: 20px;
}
.box h2,.box p{
padding-left: 20px;
padding-right: 20px;
}
</style>
</head>
<body>
<div class="box">
<h2>Headline</h2>
<p>content




content
</p>
<p class="last"><a href="images/bottom2.gif" title="test">test</a></p>
</div>
</body>
</html>
</pre>
3.滑動門技術

  1. 四個背景圖,top-left、top-right、bottom-left和bottom-right.
  2. 底部圖像和框同高
  3. html結構:
    <code>
    <div class="box">
    <div class="box-outer">
    <divc class="box-inner">
    <h2>Headline</h2>
    <p>Content</p>
    </div>
    </div>
    </div>
    </code>
  4. 圖片應用的位置:
    bottom-left——box
    bottom-righ——box-out
    top-left——box-inner
    top-right——標題
  5. CSS代碼:
    <code>
    .box{
    width:20em;
    background:#effce7 url(images/bottom-left.gif) no-repeat left bottom;
    }
    .box-outer{
    background: url(images/bottom-right.gif) no-repeat right bottom;
    padding-bottom: 1em;
    }
    .box-inner{
    background: url(images/top-left.gif) no-repeat left top;
    }
    .box h2{
    background: url(images/top-right.gif) no-repeat right top;
    padding-left: 1em;
    padding-right: 1em;
    }

</code>
4.山頂角技術

  1. 創(chuàng)建四個角的位圖角蒙版
  2. 白色的蒙版將覆蓋背景色,產(chǎn)生曲線效果
  3. html框架與滑動門一樣
  4. CSS與滑動門一樣,但是可以主框div上背景色

4.2.2 CSS3方法

1.同時添加多個圖像

  1. 由于之前只能一次添加一個圖像,所以需要多個<div>
  2. 可以只用一個<div>,同時添加四個圖像
  3. html結構:
    <code>
    <div class="box">
    <h2>Headline</h2>
    <p>Content</p>
    </div>
    </code>
  4. CSS代碼

2、border-radius
直接在CSS中用border-radius屬性

4.3投影

1.來自基礎的方法

  1. 創(chuàng)建與原圖片一樣大小的底圖
  2. 圖像放在div容器中
  3. <div>設置<float>
  4. img外邊距margin負偏移
    or 圖片設置為相對定位

2.CSS3方法

  1. 直接對圖片設置{box-shadow:apx bpx cpx #ddd}屬性
    a和b:偏移量
    c:陰影寬度
    d:顏色

ps直接設置box-shadow時也可以同時設置border-radius屬性

4.4不透明度

1.CSS方法
.alret{backgroud-color:#000
border-radius:2em;
opacity:0.8;
filter:alpha(opacity=80);/proprietary IE code/}

2.RGBa方法
設置a
.alret{backgroud-color:rgba(0,0,0,0.8);
border-radius:2em;}

3.PNG透明度
完全不懂..............

4.CSS視差效果
不太懂這個效果究竟是什么意思,代碼如下:
<pre>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<style type="text/css">

body{
    background-image: url();
    background-repeat: repeat-x;
    background-color: #d3ff99;
    background-position: 20% 0;
}
.midground{
    background-image: url();
    background-repeat: repeat-x;
    background-color: transparent;
    background-position: 40% 0;
}
.foreground{
    background-image: url();
    background-repeat: repeat-x;
    background-color: transparent;
    background-position: 150% 0;    
}

</style>

</head>
<body>
<div class="midground">
<div class="foreground">
<p>content</p>
</div>
</body>
</html>

</pre>

最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

  • 一、實驗目的 學習使用 weka 中的常用分類器,完成數(shù)據(jù)分類任務。 二、實驗內(nèi)容 了解 weka 中 explo...
    yigoh閱讀 8,858評論 5 4
  • ¥開啟¥ 【iAPP實現(xiàn)進入界面執(zhí)行逐一顯】 〖2017-08-25 15:22:14〗 《//首先開一個線程,因...
    小菜c閱讀 7,335評論 0 17
  • 一:canvas簡介 1.1什么是canvas? ①:canvas是HTML5提供的一種新標簽 ②:HTML5 ...
    GreenHand1閱讀 4,881評論 2 32
  • 這幾天都很忙,所以斷更了一天,后面幾天還很遲才有時間寫,今天趁這個空擋寫一下吧,這樣晚上就不用連睡覺也記著,今天...
    晴冰閱讀 323評論 0 0
  • 我坐在社區(qū)門口,像個慵懶的老太太。下雨了,心情舒暢得很。只是,心里好像有許多話想說。說什么呢?說人生中兩次毀滅性的...
    a7d9efee0ebd閱讀 170評論 0 0

友情鏈接更多精彩內(nèi)容