背景
2016-05-02 14:53
316 查看
1、简单背景:
(1) 图片:background: url(img/back.jpg) 20px 20px;
(2) 颜色:background: #ffff;
2、基本背景:
background-color:bisque;
background-image: url(img/back.jpg);
/*repeat-x、repeat-y、repeat、no-repeat*/
background-repeat: no-repeat;
/*要求图片固定在浏览器一角或一侧时用fixed属性,否则默认scroll*/
background-attachment: fixed;
/*repeat-x时定位左右无效,repeat-y时定位上下无效,repeat时定位完全失效*/
/*background-position:top right;*/
background-position: left top ;
3、新属性background-origin:
background-size:50px 40px;
/*背景图片的原点位置,content-box,padding-box或border-box*/
background-repeat:no-repeat;
background-origin:border-box;
4、新属性background-clip:
背景图片的剪切,content-box,padding-box或border-box,在webkit内核下还有text属性
background-image:url(img/back.jpg) ;
/*不兼容ie8*/
background-size:90px 120px;
background-repeat:no-repeat;
background-clip:border-box;
5、新属性background-size:
auto:原像素,
90px120px:自定义像素,
90px:根据这一像素,按原比例调整像素,
50%:占div的比例;
cover:放大填充
contain:按原比例缩放到div,不够的留白
6、新属性多背景属性 background:background-image|background-position|background-size|background-repeat|background-attachment|background-clip|background-origin,*
(1) 图片:background: url(img/back.jpg) 20px 20px;
(2) 颜色:background: #ffff;
2、基本背景:
background-color:bisque;
background-image: url(img/back.jpg);
/*repeat-x、repeat-y、repeat、no-repeat*/
background-repeat: no-repeat;
/*要求图片固定在浏览器一角或一侧时用fixed属性,否则默认scroll*/
background-attachment: fixed;
/*repeat-x时定位左右无效,repeat-y时定位上下无效,repeat时定位完全失效*/
/*background-position:top right;*/
background-position: left top ;
3、新属性background-origin:
background-size:50px 40px;
/*背景图片的原点位置,content-box,padding-box或border-box*/
background-repeat:no-repeat;
background-origin:border-box;
4、新属性background-clip:
背景图片的剪切,content-box,padding-box或border-box,在webkit内核下还有text属性
background-image:url(img/back.jpg) ;
/*不兼容ie8*/
background-size:90px 120px;
background-repeat:no-repeat;
background-clip:border-box;
5、新属性background-size:
auto:原像素,
90px120px:自定义像素,
90px:根据这一像素,按原比例调整像素,
50%:占div的比例;
cover:放大填充
contain:按原比例缩放到div,不够的留白
6、新属性多背景属性 background:background-image|background-position|background-size|background-repeat|background-attachment|background-clip|background-origin,*
相关文章推荐
- 笔试题44. LeetCode OJ (31)
- c实现base64
- 空字符串 null 判断
- js词法作用域
- Android学习历程之完全退出应用程序App
- socket理解
- Part 4 The Principles of Java Application Performance Tuning
- 边框
- ZeroMQ,史上最快的消息队列 —– ZMQ的学习和研究
- [Flexbox] Using flex-direction to layout content horizontally and vertically
- php中echo 与print 的区别
- HTML标签使用原则
- LeetCode 241. Different Ways to Add Parentheses
- GreenDao学习备份
- HTML5新增结构标签
- Hashmap和LinkedHashmap的对比
- 顺序表应用5:有序顺序表归并
- EntityFramework之多对多关系(四)
- Android Camera
- 悟