CSS3之背景定位原点background-origin
背景定位原点background-origin是CSS3新添加的有关背景的属性,主要是改变背景起始的原点位置的。CSS3之背景定位原点background-origin的属性值有三个:border、padding和content。下面将围绕着三个属性值为大家介绍CSS3之背景定位原点background-origin。
一、background-origin的语法
1、background-origin的语法
2、background-origin的属性值
(1)padding-box:此值为background-origin的默认值,决定background-position起始位置。从padding的外边缘(border的内边缘)开始显示背景图片;
(2)border-box:此值决定background-position起始位置从border的外边缘开始显示背景图片;
(3)content-box:此值决定background-position起始位置从content的外边缘(padding的内边缘)开始显示背景图片;
二、background-origin的兼容
1、background-origin的兼容情况
2、background-origin的兼容写法
- -moz-background-origin: padding-box || border-box || content-box;
- /*Webkit*/
- -webkit-background-origin: padding-box || border-box || content-box;
- /*Presto*/
- -o-background-origin: padding-box || border-box || content-box;
- /*W3c标准*/
- background-origin: padding-box || border-box || content-box;
三、background-origin的实例(在谷歌浏览器预览效果哟)
1、padding-box效果
CSS代码:
- -webkit-background-origin: padding-box;
- /*这是默认的位置*/
- }
HTML代码:
预览效果:
2、border-box效果
CSS代码:
- -webkit-background-origin: border-box;
- }
HTML代码:
预览效果:
3、content-box效果
CSS代码:
- div {width:200px;height:200px;background:url("http://www.leemagnum.com/img/logo.jpg") no-repeat;border:20px solid rgba(0,0,0,0.3);padding:20px;
- -webkit-background-origin: content-box;
- }
HTML代码:
- <div></div>
预览效果:
CSS3之背景定位原点background-origin就为大家介绍到这里了,希望能对大家有所帮助。更多有关CSS3的内容敬请关注梦龙小站有关CSS3的更新,感谢大家长期以来对梦龙小站的支持。
CSS3之背景定位原点background-origin的更多相关文章
- css3之背景定位
属性: background-position: left top || left bottom || right top || right bottom || center center || 像素 ...
- CSS3的背景background
CSS3中的Background属性 background: background-image || background-position/background-size || background ...
- CSS3总结二:(background)背景/渐变色函数
background-color(CSS2) background-image background-position background-size background-repeat backgr ...
- [css 揭秘]:CSS揭秘 技巧(三):背景定位
我的github地址:https://github.com/FannieGirl/ifannie 源码都在这上面哦! 喜欢的给我一个星吧 背景定位 问题:很多时候,我们想针对容器某个角对背景图片做便宜 ...
- 20190328-CSS样式一:字体样式font-、文本样式text-、背景图样式background-
目录 CSS参考手册:http://css.doyoe.com/ 1.字体简写:font:font-style || font-variant || font-weight || font-size ...
- css3-background clip 和background origin
1.background-origin background-origin 里面有3个参数 : border-box | padding-box | content-box; border-box,p ...
- css3 Gradient背景
css3的gradient分为两种:线性渐变(linear)和径向渐变(radial). 一.线性渐变linear-gradient 1.介绍 linear-gradient([设置方向],[设置开始 ...
- CSS3之背景剪裁Background-clip
CSS3之背景剪裁Background-clip是CSS3中新添加的内容.这个属性还是比较简单的,主要分五个属性值:border.padding.content.no-clip和text.下面将针对这 ...
- [css]《css揭秘》学习(三)-灵活的背景定位
一.background-position属性 使用该属性,在不确定容器大小的情况下,也可以指定图案距离容器边缘的位置:但是需要为不支持该属性的浏览器指定回退方案,否则,图案会默认放在左上角. < ...
随机推荐
- 13.UiAutomator 辅助APK的使用
一.在测试中弹出提示框 UiAutomator无法直接实现,,但是可以通过让辅助APK接受UiAutomator发送的指令信息来实现,使用am命令 实例: 1.新建辅助apk,用来接收Uiautoma ...
- 基于OpenResty和Node.js的微服务架构实践
什么是微服务? 传统的单体服务架构是单独服务包,共享代码与数据,开发成本较高,可维护性.伸缩性较差,技术转型.跨语言配合相对困难.而微服务架构强调一个服务负责一项业务,服务可以单独部署,独立进行技术选 ...
- struts标签错误:Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
今天使用eclipse开发ssh,出现Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/co ...
- C语言基本类型的字节数
- Vue.js随笔二(新建路由+component+添加样式+变量的显示)
创建一个页面: 1.首先让我们看一下整个vue.js的目录,如下图所示: 2.现在让我们创建一个页面吧: 2-1首先你需要新建路由(就和建立一个如何找到项目文件的目录一个意思):进入src/route ...
- eclipse+myeclipse 使用技巧备忘
myeclipse 导入多模块maven项目 https://blog.csdn.net/jack85986370/article/details/51371853 maven项目在eclipse的l ...
- 深入浅出CSS(一):line-height与vertical-align的性质
[测试代码] <!DOCTYPE html> <html lang="en"> <head> <meta charset="UT ...
- 扫描线(线段树)+贪心 ZOJ 3953
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5572 Intervals Time Limit: 1 Second ...
- 816C. Karen and Game 贪心
LINK 题意:给出n*m的矩阵图,现有对行或对列上的数减1的操作,问最少几步使所有数变为0,无解输出-1 思路:贪心暴力即可.先操作行和先操作列结果可能不同注意比较. /** @Date : 201 ...
- iOS 监听UILabel点击
label.userInteractionEnabled = YES; // 一定要设置 [label addGestureRecognizer:[[UITapGestureRecognizer al ...