一、理论:

1.background-break 

a.bounding-box 背景图像在整个内联元素中进行平铺

b.each-box 背景图像在行内中进行平铺

c.continuous 下一行的背景图像紧接着上一行中的图像继续平铺

以上仅在firefox下可用

2.css多背景

a.background-image 设置元素背景图片民,可用相对地址或绝对地址索引背景图像

b.background-repeat 设置元素背景图像的平铺方式 默认repeat

c.background-size 设置元素背景图像的尺寸大小 默认auto

d.background-attachment 设置元素的背景图片是否固定 默认scroll

e.background-clip 控制元素背景图像显示区域大小,默认border-box

f.background-color 设置元素背景颜色

g.多个属性中间必须用","分开

h.最先声明的背景图片将会居于最上层,最后指定的图片放于最底层

二、实践:

1.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
body{
background: #000 url(images/2-11-test.jpg) center center fixed no-repeat;
-moz-background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
@media only all and (max-width:1024px) and (max-height: 768px){
body{
-moz-background-size: 1024px 768px;
-webkit-background-size: 1024px 768px;
-o-background-size: 1024px 768px;
background-size: 1024px 768px;
}
}
@media only all and (max-width:640px) and (max-height: 480px){
body{
-moz-background-size: 640px 480px;
-webkit-background-size: 640px 480px;
-o-background-size: 640px 480px;
background-size: 640px 480px;
}
}
</style>
</head>
<body>
<div></div>
<div class="div1" ></div>
<div class="div2" ></div>
<div class="div3" ></div>
<div class="div4" ></div>
</body>
</html>

2.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
.demo{
width: 500px;
height: 300px;
border:20px solid rgba(104,105,168,0.5);
border-radius: 10px;
padding: 80px 60px;
color:#123589;
font-size: 25px;
line-height: 1.5;
text-align: center;
}
.multipleBg{
background: url("images/round-box1.jpg") no-repeat left top,
url("images/round-box-2.jpg") no-repeat right top,
url("images/border-radius.jpg") no-repeat left bottom,
url("images/tabs-image.jpg") no-repeat right bottom,
url("images/border.jpg") no-repeat right bottom;
-webkit-background-origin: border-box,border-box,border-box,border-box,padding-box;
-moz-background-origin: border-box,border-box,border-box,border-box,padding-box;
-o-background-origin: border-box,border-box,border-box,border-box,padding-box;
background-origin: border-box,border-box,border-box,border-box,padding-box;
-moz-background-clip: border-box;
-webkit-background-clip: border-box;
-o-background-clip:border-box;
background-clip: border-box;
}
</style>
</head>
<body>
<div class="demo multipleBg">用五张背景图片做出这种效果</div>
</body>
</html>

CSS学习(九)-CSS背景的更多相关文章

  1. Html和Css学习笔记-css进阶-盒模型

    我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 此篇博客是我的复习笔记,html和css学的时间太久了,忘得差不多了,最近要使用一下,所以重新打开html的书略读,后记录了标签 ...

  2. 【CSS学习笔记】背景图片

    直接看代码: background: blue; /*页面背景为蓝色,很简单的代码*/background-image:url(small.jpg); /*页面背景是名字叫small.jpg的图片*/ ...

  3. CSS学习笔记——CSS选择器样式总结

    <style type="text/css"> * { padding:0; margin:0; } .box h2 { //内边距左边的距离 padding-left ...

  4. Html和Css学习笔记-css基础知识

    我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 此篇博客是我的复习笔记,html和css学的时间太久了,忘得差不多了,最近要使用一下,所以重新打开html的书略读,后记录了标签 ...

  5. CSS学习笔记——CSS中定位的浮动float

    昨天在解决了盒模型的问题之后又出现了新的知识模糊点:浮动和绝对定位?今天先解决浮动相关的问题,首先列举出想要解决的问题: 1.浮动到底是怎么样的? 2.浮动对元素的影响有什么? 3.浮动主要用来干什么 ...

  6. CSS 学习笔记——CSS Selector

    CSS1 中定义的选择器 类型选择器 用于选择指定类型的元素(其实他就是 html 标签选择器),常见用法如下: body { /*对 body 元素定义样式*/ } body,div { /*同时选 ...

  7. css学习_div+css布局

    1.布局(盒子布局.盒子模型.标准流.脱离文档流) 标准文档流:块级独占一行  ,行内块和行内元素都是和其他共占一行,在盒子中的元素遵循标准流从左到右从上到下排列,超过父元素时会溢出. 一行行看 浮动 ...

  8. 【CSS学习】--- 背景

    一.前言 元素的背景区域包括:元素的内容.内边距和边框区域. CSS中用于设置背景的属性有: background-color 设置背景颜色 background-image 设置背景图片 backg ...

  9. HTML学习笔记 CSS背景样式案例 第六节 (原创) 参考使用表

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. 值得学习的CSS知识

    这里零度给大家推荐几个值得学习的CSS技巧,能让你编写网页事半功倍!一.清除默认值 通常 padding 的默认值为 0,background-color 的默认值是 transparent.但是在不 ...

随机推荐

  1. nginx静态资源浏览器缓存

    1.缓存介绍 作用:提升用户体验,减少服务器压力 浏览器无缓存:浏览器发起请求->无缓存->请求WEB服务器->web服务器检查是否有更新(没有更新返回304)->呈现 浏览器 ...

  2. PowerShell 获取系统的硬件信息

    1.获取系统的BIOS的信息: Get-WMIObject -Class Win32_BIOS 2.获取内存信息: Get-WMIObject -Class Win32_PhysicalMemory ...

  3. 洛谷P1514 引水入城 [搜索,区间DP]

    题目传送门 引水入城 题目描述 在一个遥远的国度,一侧是风景秀美的湖泊,另一侧则是漫无边际的沙漠.该国的行政区划十分特殊,刚好构成一个 N 行×M 列的矩形,如上图所示,其中每个格子都代表一座城市,每 ...

  4. 洛谷——P1478 陶陶摘苹果(升级版)

    题目描述 又是一年秋季时,陶陶家的苹果树结了n个果子.陶陶又跑去摘苹果,这次她有一个a公分的椅子.当他手够不着时,他会站到椅子上再试试. 这次与NOIp2005普及组第一题不同的是:陶陶之前搬凳子,力 ...

  5. Linux命令之chmod

    chmod [选项] … MODE[,MODE] … FILE … chmod [选项] … OCTAL-MODE FILE … chmod [选项] … --reference=RFILE FILE ...

  6. 解决CDH的web界面使用nginx代理一些静态文件无法加载

    vim /opt/cm-/share/cmf/webapp/WEB-INF/spring/mvc-config.xml .... 注释此行 <bean class="com.cloud ...

  7. coreseek mmseg分词配置和创建

    1.文件格式为 沃尔沃 1x:1现代 1x:1徐工 1x:1住友 1 ... 3.将生成的符合格式要求的词表粘贴到原词表unigram.txt末尾,保存为unigram_new.txt,并拷贝到mms ...

  8. [NOIp2016提高组]愤怒的小鸟

    题目大意: 平面直角坐标系的第一象限有n(n<=18)个点,你可以每次给出一个形如y=ax^2+bx的函数把经过这条函数的点消掉,问消掉所有的点至少要多少函数? 思路: 枚举每两个点对,可以唯一 ...

  9. Problem B: 零起点学算法92——元素前移1位

    #include<stdio.h> int main() { ],b[]; while(scanf("%d",&n)!=EOF) { ;i<n;i++) ...

  10. Codeforces Gym 100269A Arrangement of Contest 水题

    Problem A. Arrangement of Contest 题目连接: http://codeforces.com/gym/100269/attachments Description Lit ...