background

background: (1)url(image1.png) right bottom, (2)url(image2.png) center, (3)url(image3.png) (4)rgba( 0,0,0,0.35)

  • (1)The first background image. This is the image that is closest to the viewer. Every background image can have the general values of the background property, where the most important arebackground-position and background-repeat. By default they are positioned top left and get repeated at the x- and y-axis.第一张背景图是最靠近可视层的。每一个背景图都有通用的背景属性,最重要的是background-position和bckground-repeat。默认是定位在左上角,而且x与y轴重复。
  • (4)The general background color of the element. Can be only set last, no comma preceded.元素的背景颜色只能最后设置,没有逗号分隔。

background-clip

Sets the visible range of the background including background images.设置背景图片的有效范围

(1)border-box , (2)padding-box,(3)content-box

  • (1)By default the background of a box (element) is drawn beneath the border, that is the border covers it (= border-box, default value). To change this behaviour it’s possible
  • to use the values padding-box and content-box (Firefox 3.6 uses border and padding instead,content is not supported).元素默认的背景绘制在边框之下,也就是边框会覆盖背景层(默认值border-box)。可以使用paddng-box和content-box来改变这种行为。
  • (2)If a border is set the background starts directly within it, everything outside gets clipped. Same as the default value (border-box) when no border is set.如果在元素设置了边框,超出位置会被截取。即不会绘制到border之下。与不设置border的border-box一样效果。
  • (3)If a padding is set the background gets applied within it, everything outside is clipped. Same as padding-box when no padding is set, same as padding-box and border-box when no padding and no border are set.如果背景设置了padding,除了内容外都截取。与没有padding的padding-box一样,与没有设置padding和border的padding-box,border-box一样。

background-origin

(1)padding-box , (2)border-box,(3)content-box

  • (1) When background images are applied they directly start at the outer dimensions of the containing element (= padding-box, default value). In the presence of a border they start directly within it. Can also be content-box or border-box (Firefox 3.6 uses padding,content and border).当设置背景图片时,它是从元素的边界开始(默认是padding-box)。如果存在边框,则在边框内开始。还可以设置content-box和border-box。
  • (2)If a border is set it covers the background images. Same as padding-box when no border is set.如果设置了边框,而且设置border-box,边框就会覆盖在背景图上。如果没有设置边框则与padding-box一样。
  • (3)If a padding is set the background image gets applied within it. Same as padding-box when no padding is set, same as padding-box and border-box when no padding and no border are set.设置了content-box,如果设置了padding,背景图则应用于padding内。和没有设置padding的padding-box一样,和没有设置border与padding的botder-box、padding-box一样。

background-size

background-size:(1)50% 100%, (2)33% 33%, auto, 100px

  • The horizontal size of the background image, in this case 50% of the width of the element (not of the original image size). 第一个值50%是指背景图为元素宽度的50%(并不是原始图的尺寸)Can also be set in absolute (px) or relative (em) units, can be auto (original size, default),cover or contain. 也可以是px或者em,也可以是auto,cover和contain关键字。In combination with multiple background images the different values are separated by commas.多个背景图时用逗号隔开。(x y 当缺省状态则为auto,例如最后一个则是100px auto)

background-size: cover

  • The background image is resized so that either its width or height (the smaller one) covers the whole element. The aspect ratio is preserved.背景图会重置宽度或者高度(小者)以覆盖整个元素(必定保证整个元素被覆盖)。保留了长宽比。

background-size: contain

  • The background image is resized so that its width or height (the bigger one) fits inside the element. 背景图会重置以至于宽或高(大者)填满元素The aspect ratio is preserved.保留了长宽比。

原文:http://www.css3files.com/background/

css3之background的更多相关文章

  1. CSS3中background属性的调整

    CSS3对于background做了一些修改,最明显的一个就是采用设置多背景,不但添加了4个新属性,并且还对目前的属性进行了调整增强. 1.多个背景图片 在css3里面,你可以再一个标签元素里应用多个 ...

  2. css3 背景background

    Css3背景<background> Css3包含多个新的背景属性,它们提供了对背景更强大的控制.可以自定义背景图的大小,可以规定背景图片的定位区域,css3还允许我们为元素使用多个背景图 ...

  3. css2和CSS3的background属性简写

    1.css2:background:background-color || url("") || no-repeat || scroll || 0 0;  css3:  backg ...

  4. css3的Background新属性

    前言 CSS3中出现了几种关于背景图片的新属性:background-origin.background-clip.background-position等.之前大致了解了下,但是background ...

  5. CSS背景和CSS3背景background属性

    css背景属性用于定义HTML元素的背景 背景属性既可以为单个的单元设置背景,也可以为整个页面设置背景,可以对上述二者的任意组合设置背景,段落.文字.不同状态的链接.图像.内容区域修改其背景样式.设置 ...

  6. [CSS3] CSS Background Images

    Body with background image and gradient html { background: linear-gradient(#000, white) no-repeat; h ...

  7. 巧用CSS3之background渐变

    常见斑马loading 上图是我们常见的loading进度条,以前都是用一张背景图片平铺的.其实如果抛去兼容性因素,我们可以用零图片纯样式来实现. 一,首先,我们先为容器定义一个纯蓝色背景: box{ ...

  8. css3 background

    background是一个很重要的css属性,在css3中新增了很多内容.一方面是原有属性新增了属性值,另一方面就是新增了3个属性. 一.css3中新增属性值介绍 css2的background有5个 ...

  9. CSS3详解:background

    CSS3对于background做了一些修改,最明显的一个就是采用设置多背景,不但添加了4个新属性,并且还对目前的属性进行了调整增强. 1.多个背景图片 在css3里面,你可以再一个标签元素里应用多个 ...

随机推荐

  1. SCM管理器

    OpenSCManager 打开SCM管理器 CloseServiceHandle 关闭句柄 CreateService 创建服务 OpenService 打开服务 ControlService 控制 ...

  2. C语言整数按照二进制逆序,输出逆序后的整数值

    问题来源,今天早上和一舍友吃早餐的时候谈到的一个问题,将一个整数按照二进制逆序,然后输出逆序后的数值. 我们知道数值在内存中都是以二进制的形式存放的,假如我们是32位机,每8位为一个字节,int型在3 ...

  3. MVC + LigerUI 做后台管理还真是清爽

    LigerUI是基于Jquery,轻量级UI框架.具体可以看官方演示 http://www.ligerui.com/ 我的简单后台 模拟Winodw桌面效果,挺不错呢.最喜欢的还是他的,下拉列表绑定G ...

  4. NMAP扫描UDP123NTP端口详解

    我用的nmap版本:Zenmap 6.25 例如命令: nmap -sU -pU:123 -Pn -n --script=ntp-monlist IP 如果要批量进行,可以把IP存放在ip.txt可以 ...

  5. 检测IIS应用程序池对象 回收

    function RecycleYourAppPool([string] $poolName){ Import-Module WebAdministration #获取所有Application Po ...

  6. GitHub的使用详解!Windows GitHub ,Sublime Git GitGutter的使用!

    Github是什么? 它是代码管理工具. 在公司写的代码,不需要U盘拷贝回家,不需要放到网盘中.只需要上传到git上,就可以回家继续拷贝下来了. 比起svn要好, svn只适合局域网工作,离开局域网, ...

  7. 设计模式(十一):FACADE外观模式 -- 结构型模式

    1. 概述 外观模式,我们通过外观的包装,使应用程序只能看到外观对象,而不会看到具体的细节对象,这样无疑会降低应用程序的复杂度,并且提高了程序的可维护性.例子1:一个电源总开关可以控制四盏灯.一个风扇 ...

  8. Delphi 在使用exports中的方法 带参数的用法

    最近项目中,需要在一个bpl中调用另一个bpl中的单元的方法, 方法如下: 在被调用的单元中定义: procedure Inner_Ex(VoucherType: TVoucherType); exp ...

  9. 实现QQslidingMenu侧滑效果学习笔记

    声明:只是自己的学习笔记,所以,只作为博友的参考,不喜勿喷 实现思路: 自定义继承HorizontalScrollView的控件 项目github地址: https://github.com/ysno ...

  10. Java如何让异常处理机制更完备规范

    1)catch的Exception一定要详细的点名是某种异常而非一概而论的用Exception ex来接收所有的异常,往往不理解这点的人也不能很好的理解catch的意义到底在哪里,是对捕获的异常进行一 ...