CSS学习(九)-CSS背景
一、理论:
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背景的更多相关文章
- Html和Css学习笔记-css进阶-盒模型
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 此篇博客是我的复习笔记,html和css学的时间太久了,忘得差不多了,最近要使用一下,所以重新打开html的书略读,后记录了标签 ...
- 【CSS学习笔记】背景图片
直接看代码: background: blue; /*页面背景为蓝色,很简单的代码*/background-image:url(small.jpg); /*页面背景是名字叫small.jpg的图片*/ ...
- CSS学习笔记——CSS选择器样式总结
<style type="text/css"> * { padding:0; margin:0; } .box h2 { //内边距左边的距离 padding-left ...
- Html和Css学习笔记-css基础知识
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 此篇博客是我的复习笔记,html和css学的时间太久了,忘得差不多了,最近要使用一下,所以重新打开html的书略读,后记录了标签 ...
- CSS学习笔记——CSS中定位的浮动float
昨天在解决了盒模型的问题之后又出现了新的知识模糊点:浮动和绝对定位?今天先解决浮动相关的问题,首先列举出想要解决的问题: 1.浮动到底是怎么样的? 2.浮动对元素的影响有什么? 3.浮动主要用来干什么 ...
- CSS 学习笔记——CSS Selector
CSS1 中定义的选择器 类型选择器 用于选择指定类型的元素(其实他就是 html 标签选择器),常见用法如下: body { /*对 body 元素定义样式*/ } body,div { /*同时选 ...
- css学习_div+css布局
1.布局(盒子布局.盒子模型.标准流.脱离文档流) 标准文档流:块级独占一行 ,行内块和行内元素都是和其他共占一行,在盒子中的元素遵循标准流从左到右从上到下排列,超过父元素时会溢出. 一行行看 浮动 ...
- 【CSS学习】--- 背景
一.前言 元素的背景区域包括:元素的内容.内边距和边框区域. CSS中用于设置背景的属性有: background-color 设置背景颜色 background-image 设置背景图片 backg ...
- HTML学习笔记 CSS背景样式案例 第六节 (原创) 参考使用表
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 值得学习的CSS知识
这里零度给大家推荐几个值得学习的CSS技巧,能让你编写网页事半功倍!一.清除默认值 通常 padding 的默认值为 0,background-color 的默认值是 transparent.但是在不 ...
随机推荐
- 开源游戏地图编辑器MarbleMap
开源游戏地图编辑器MarbleMap MIT协议,MarbleMap是一款as3开发的游戏地图编辑器,他免费开源,同时支持Cocos2d-x坐标系和AS3坐标系,功能丰富,不过是一款新推出的开源项目, ...
- 【ASP.NET】IHttpHandler和IHttpModule
上篇文章我们主要讲了HttpApplicatiion管道事件,那么我么如何处理这些管道事件呢,以及请求在ASP.NET是如何执行的呢,我们来了解一下IHttpHandler和IHttpModule 引 ...
- NOIP2018 提高组题解
Day1 T1 据说是原题积木大赛,但是考场上蠢了,只会写数据结构,于是写了一个线段树\(+\)堆\(+\)贪心,先选出最小的,然后区间修改,然后把左右两端区间的最小值丢进堆里,不停从堆中去最小值更新 ...
- Linux命令之locate
locate [选项] [pattern] 在mlocate数据库中搜索条目.配合数据库缓存快速查看文件相关位置. locate命令和find -name功能差不多,但是比find搜索要快.因为fin ...
- Mybatis 使用Mybatis时实体类属性名和表中的字段名不一致
开发中,实体类中的属性名和对应的表中的字段名不一定都是完全相同的,这样可能会导致用实体类接收返回的结果时导致查询到的结果无法映射到实体类的属性中,那么该如何解决这种字段名和实体类属性名不相同的冲突呢? ...
- ProxyStrike运行bug解决办法
ProxyStrike运行bug解决办法 由于curl中参数CURLOPT_SSL_VERIFYHOST的值取消原有的值1,导致ProxyStrike无法正常运行.所以,要运行该工具,需要手动修改/ ...
- hdu 2196(Computer 树形dp)
A school bought the first computer some time ago(so this computer's id is 1). During the recent year ...
- 求高精度幂(poj1001)
Description Problems involving the computation of exact values of very large magnitude and precision ...
- 2. let和const命令--ES6
1. let命令 let 命令不存在变量提升let 命令 只在let命令所在的代码块内有效. { let a = 10; var b = 1; } a // ReferenceError: a is ...
- 【jzyzoj】【p1320 patrol】 巡逻(网络流最小割例题)
描述 Description FJ有个农场,其中有n块土地,由m条边连起来.FJ的养牛场在土地1,在土地n有个新开张的雪糕店.Bessie经常偷偷溜到雪糕店,当Bessie去的时候,FJ就要跟上她.但 ...