先来看下语法:

background-size: length|percentage|cover|contain;

具体的值,百分比都ok,w3c上面说的很清楚,当时具体的值或者百分比的时候,第一个表示宽,第二个表示高,高度不设置的话会设为auto,

缺点:
图片会变形
cover:背景图像完全覆盖背景区域,会随背景区域的大小等比例缩放
缺点:
背景图像的某些部分也许无法显示在背景定位区域中。
contain:把图像图像扩展至最大尺寸,以使其宽度和高度完全适应内容区域。
缺点:

容器会留白

css background-size的更多相关文章

  1. CSS background 属性详解

    CSS background Property 语法: background: bg-color bg-image position/bg-size bg-repeat bg-origin bg-cl ...

  2. CSS 背景-CSS background

    这里有个很好的样式学习网站:http://www.divcss5.com/rumen/r125.shtml 一.Css background背景语法   -   TOP CSS背景基础知识 CSS 背 ...

  3. CSS background 属性 总结

    CSS background 属性总结

  4. HTML CSS——background的认识(一)

    今天回归bug时无意间看到了样式表中background属性,如今总结一下: 1.background-color:设置元素的背景色.其值能够为:color-name.color-rgb.color- ...

  5. css background之设置图片为背景技巧

    css background之设置图片为背景技巧-css 背景 Background是什么意思,翻译过来有背景意思.同样在css里面作为css属性一成员同样是有背景意思,并且是设置背景图片.背景颜色. ...

  6. CSS background 之设置图片为背景技巧

    首先先来看看background有那些值: 可以按顺序设置如下属性(可点击进入相应的css手册查看使用):background-color 背景颜色background-image 背景图片backg ...

  7. [CSS3] CSS Background Images

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

  8. css background之设置图片为背景技巧

    原文 Background是什么意思,翻译过来有背景意思.同样在css里面作为css属性一成员同样是有背景意思,并且是设置背景图片.背景颜色.背景图片截取等样式. 首先先来看看background有那 ...

  9. css background transparent All In One

    css background transparent All In One opacity ul { max-height: 100px; /* max-height: 187px; */ overf ...

  10. css & background & svg

    css & background & svg https://developer.mozilla.org/en-US/docs/Web/CSS/background backgroun ...

随机推荐

  1. Android学习日记

    1.[2013-10-03 13:45:38 - FileManager] res\drawable-xxhdpi\FileManager.jpg: Invalid file name: must c ...

  2. 更新证书错误:No matching provisioning profiles found

    在Xcode中当你在更新了你得证书而再重新编译你的程序,真机调试会出现“Your build settings specify a provisioning profile with the UUID ...

  3. Bootstrap <基础二十一>徽章(Badges)

    Bootstrap 徽章(Badges).徽章与标签相似,主要的区别在于徽章的边角更加圆滑. 徽章(Badges)主要用于突出显示新的或未读的项.如需使用徽章,只需要把 <span class= ...

  4. Newtonsoft.Json 序列化和反序列化 时间格式

    From : http://www.cnblogs.com/litian/p/3870975.html 1.JSON序列化 string JsonStr= JsonConvert.SerializeO ...

  5. java培训第一天--画板

    package day1; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt ...

  6. 前端开发week1

    1.前端开发前期相关工具 photoshop:主要学习运用与前端相关工具,了解UI与前端的关联.    axure:原型设计,通过设计原型了解网页基本结构,结合ps对UI有更好的理解.    webs ...

  7. 提高开发效率的十五个Visual Studio 2010使用技巧

    相信做开发的没有不重视效率的.开发C#,VB的都知道,我们很依赖VS,或者说,我们很感谢VS.能够对一个IDE产生依赖,说明这个IDE确实有它的独特之处.无容置疑,VS是一个非常强大的IDE,它支持多 ...

  8. Linux学习 :移植linux-4.7.4到JZ2440开发板

    一.编译环境搭建: 1.linux源码下载:https://www.kernel.org/2.安装交叉编译工具链: ①手动下载配置工具链: (1):解压 arm-linux-gcc-3.4.1.tar ...

  9. php 循环删除目录中的过期文件

            $savepath1 = 'Public/biaoqian/upload';         $path1 = dir($savepath1);           while (($ ...

  10. 第二篇.Bootstrap起步

    第二篇Bootstrap起步 我们可以在http://getbootstrap.com下载bootstrap的文件 点击左边的download bootstrap可以下载bootstrap的css,j ...