CSS background 属性详解
语法:
background: bg-color bg-image position/bg-size bg-repeat bg-origin bg-clip bg-attachment initial|inherit;
Note: If one of the properties in the shorthand declaration is the bg-size property, you must use a / (slash) to separate it from the bg-position property, e.g. background:url(smiley.gif) 10px 20px/50px 50px; will result in a background image, positioned 10 pixels from the left, 20 pixels from the top, and the size of the image will be 50 pixels wide and 50 pixels high.
Note: If using multiple background-image sources but also want a background-color, the background-color parameter needs to be last in the list.
background-color
Default value: transparent
The background-color property sets the background color of an element.
The background of an element is the total size of the element, including padding and border (but not the margin)(包括内边距和边框).
background-position
The background-position property sets the starting position of a background image(背景图片的开始位置).
Tip: By default, a background-image is placed at the top-left corner of an element, and repeated both vertically and horizontally.
background-size
The background-size property specifies the size of the background images.
语法:
background-size: auto|length|cover|contain|initial|inherit;
background-repeat
The background-repeat property sets if/how(背景图片的重复/循环方式) a background image will be repeated.
By default, a background-image is repeated both vertically and horizontally.
Tip: The background image is placed according to the background-position property. If no background-position is specified, the image is always placed at the element's top left corner.
background-repeat: repeat|repeat-x|repeat-y|no-repeat|initial|inherit;
background-origin
Default value: padding-box
The background-origin property specifies where the background image is positioned.
Note: If the background-attachment property is set to "fixed", this property has no effect.
background-origin: padding-box|border-box|content-box|initial|inherit;
background-clip
The background-clip property specifies the painting area of the background.
background-clip: border-box|padding-box|content-box|initial|inherit;
background-attachment
The background-attachment property sets whether a background image is fixed or scrolls with the rest of the page.
background-attachment: scroll|fixed|local|initial|inherit;
CSS background 属性详解的更多相关文章
- CSS中background属性详解
CSS背景属性 background css 说明 background-image:url(图片的网址); 背景图 background: url( 图片的网址 ); 背景 background-c ...
- [转]CSS vertical-align属性详解 作者:黄映焜
CSS vertical-align属性详解 posted @ 2014-08-26 17:44 黄映焜 前言:关于vertical-align属性. 实践出真知. 垂直居中. 第二种用法. ...
- css 12-CSS3属性详解:动画详解
12-CSS3属性详解:动画详解 #前言 本文主要内容: 过渡:transition 2D 转换 transform 3D 转换 transform 动画:animation #过渡:transiti ...
- css 11-CSS3属性详解(一)
11-CSS3属性详解(一) #前言 我们在上一篇文章中学习了CSS3的选择器,本文来学一下CSS3的一些属性. 本文主要内容: 文本 盒模型中的 box-sizing 属性 处理兼容性问题:私有前缀 ...
- css 14-CSS3属性详解:Web字体
14-CSS3属性详解:Web字体 #前言 开发人员可以为自已的网页指定特殊的字体(将指定字体提前下载到站点中),无需考虑用户电脑上是否安装了此特殊字体.从此,把特殊字体处理成图片的方式便成为了过去. ...
- css display属性详解
css display属性在对css做layout设计时非常重要,它的值有以下几种: Value Description Play it inline Default value. Displays ...
- CSS透明属性详解代码
透明往往能产生不错的网页视觉效果,先奉上兼容主流浏览器的CSS透明代码: 代码如下: .transparent_class { filter:alpha(opacity=50); -moz-opaci ...
- CSS边框-属性详解
图解CSS padding.margin.border属性 W3C组织建议把所有网页上的对像都放在一个盒(box)中,设计师可以通过创建定义来控制这个盒的属性,这些对像包括段落.列表.标题.图片以及层 ...
- css float属性详解
定义和用法 float 属性定义元素在哪个方向浮动.以往这个属性总应用于图像,使文本围绕在图像周围,不过在 CSS 中,任何元素都可以浮动.浮动元素会生成一个块级框,而不论它本身是何种元素.如果浮动非 ...
随机推荐
- 使用二叉搜索树实现一个简单的Map
之前看了刘新宇大大的<算法新解>有了点收获,闲来无事,便写了一个二叉搜索树实现的Map类. java的Map接口有很多不想要的方法,自己定义了一个 public interface IMa ...
- System Verilog基础(二)
这一篇笔记主要记录Procedural,Process,Task and function,Interface和Communication中值得注意的点. 1.Procedural 写testbenc ...
- Ubuntu里面vi编辑器在编辑文本时 如何在所有行行首或行尾插入字符
例如:我这里是在每一行行首插入new :%s/^/new 在20,50行首插入new :20,50s/^/new 在每一行行尾插入@@ :%s/$/@@ 在20到50行行尾插入## :20,50s/$ ...
- Chrome DevTools的15个使用技巧(译)
谷歌浏览器如今是Web开发者们所使用的最流行的网页浏览器.伴随每六个星期一次的发布周期和不断扩大的强大的开发功能,Chrome变成了一个必须掌握的工具.大多数前端开发者可能熟悉关于chorme的许多特 ...
- Linux 下使用yum 命令安装MySQL
Linux下使用yum安装MySQL,以及启动.登录和远程访问MySQL数据库. 1.yum安装mysql 1. 查看有没有安装包: yum list mysql* #移除已经安装的mysq ...
- 个人常用的vba代码
只做备注 Sub general_sql_macro() Sql = "" column_name = "user_count" Sql = "ins ...
- centos6.5下安装zip格式的tomcat7和tomcat8,并同时运行
前提: 我的tomcat7安装在 /home/hadoop/software/apache-tomcat-7.0.69, tomcat8安装在 /home/hadoop/software/apache ...
- mock时忽略不必要的初始化
PowerMockito.mockStatic时忽略加载类的静态field,比如想PowerMockito.mockStatic(ClassA.class),ClassA如下 public class ...
- leetcode2:线性表
/********************************************** Function:input two array and find the kth value the ...
- javascript 遍历
数组的遍历你都会用了,那Promise版本的呢 这里指的遍历方法包括:map.reduce.reduceRight.forEach.filter.some.every因为最近要进行了一些数据汇总,no ...