Chapter 4 背景图像

4.2圆角框

4.2.1传统方法

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. 创建四个角的位图角蒙版
  2. 白色的蒙版将覆盖背景色,产生曲线效果
  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. 创建与原图片一样大小的底图
  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>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一、实验目的 学习使用 weka 中的常用分类器,完成数据分类任务。 二、实验内容 了解 weka 中 explo...
    yigoh阅读 12,768评论 5 4
  • ¥开启¥ 【iAPP实现进入界面执行逐一显】 〖2017-08-25 15:22:14〗 《//首先开一个线程,因...
    小菜c阅读 11,844评论 0 17
  • 一:canvas简介 1.1什么是canvas? ①:canvas是HTML5提供的一种新标签 ②:HTML5 ...
    GreenHand1阅读 10,190评论 2 32
  • 这几天都很忙,所以断更了一天,后面几天还很迟才有时间写,今天趁这个空挡写一下吧,这样晚上就不用连睡觉也记着,今天...
    晴冰阅读 1,950评论 0 0
  • 我坐在社区门口,像个慵懒的老太太。下雨了,心情舒畅得很。只是,心里好像有许多话想说。说什么呢?说人生中两次毁灭性的...
    a7d9efee0ebd阅读 1,027评论 0 0