CSS3 background
来源:互联网 发布:mac最新系统版本10.13 编辑:程序博客网 时间:2024/06/11 09:31
background多背景图片:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> #div1 {background: url(img/billiard.png),url(img/medal.png) ; background-size: 300px 300px; width: 300px;height: 300px; } </style></head><body> <div id="div1"> </div></body></html>
效果如图:
background-origin:
background-origin 属性规定背景图片的定位区域
三个值:
- padding-box:背景图片相对于内边距框来定位
- border-box:背景图片相对于边框盒来定位
- content-box:背景图片相对于内容框来定位
1.padding-box
<style type="text/css"> #div1 { border: 30px dotted #eee; padding:20px;width: 200px;height: 200px;background-image: url(img/trophy.png) ; background-repeat: no-repeat; background-size: 200px 200px; background-origin: padding-box; }</style>
效果如下图:这是从padding开始定位背景图片
2.border-box
<style type="text/css"> #div1 { border: 30px dotted #999; padding:20px;width: 200px;height: 200px;background-image: url(img/trophy.png) ; background-repeat: no-repeat; background-size: 200px 200px; background-origin: border-box; }</style>
背景效果如下:
3.content-box
<style type="text/css"> #div1 { border: 3px dotted #999; padding:20px;width: 200px;height: 200px;background-image: url(img/trophy.png) ; background-repeat: no-repeat; background-size: 200px 200px; background-origin: content-box; }</style>
background-clip
background-clip规定背景的绘制区域
有三个属性值:
- border-box:背景被裁减到边框盒
- padding-box:背景被裁减到内边框距
- content-box:背景被裁减到内容框
1.border-box
<style type="text/css"> #div1 { border: 30px dotted #999; padding:20px;width: 200px;height: 200px;background-image: url(img/trophy.png) ; background-repeat: no-repeat; background-size: 200px 200px; background-origin: border-box; background-clip: border-box; }</style>
效果图
2.padding-box
<style type="text/css"> #div1 { border: 30px dotted #999; padding:20px;width: 200px;height: 200px;background-image: url(img/trophy.png) ; background-repeat: no-repeat; background-size: 200px 200px; background-origin: border-box; background-clip: padding-box; }</style>
效果图:
3.content-box
<style type="text/css"> #div1 { border: 30px dotted #999; padding:20px;width: 200px;height: 200px;background-image: url(img/trophy.png) ; background-repeat: no-repeat; background-size: 200px 200px; background-origin: border-box; background-clip: content-box; }</style>
效果图:
阅读全文
0 0
- [CSS3] Background
- <css3>background
- CSS3 Background
- CSS3 background
- 【CSS3】---background-origin background-clip background-size
- CSS3 background-size属性
- css3 background-size 用法
- css3 background-size
- CSS3 Background-clip
- CSS3 Multiple Background
- CSS3之多背景background
- css3的background-origin
- CSS3之background-origin
- CSS3之background-clip
- CSS3 Background-size
- CSS3详解:background
- CSS3-background-size
- CSS3 Background-size 详解
- JNI动态注册方法
- 呵呵了。。
- 51nod 1326 遥远的旅途 最短路建模
- ubuntu14.04安装搜狗输入法(亲测)
- 北京信息学培训第七天
- CSS3 background
- Android Studio 快捷键
- 打动人的瞬间·《毛骗》
- JAVA线程间通信的几种方式
- 【HPU OJ 1409 】Watch Dog 【最小生成树】
- Servlet示例项目
- Python configparser修改配置文件
- git常用命令总结
- UVa10285 Longest Run on a Snowboard