css3 backgound背景的一些用法 和background-position用法
2015-08-30 01:50
701 查看
body{background:url(images/haoroomsicon.jpg);
background-size: 60px 100px;
-moz-background-size:60px 100px;
padding-top: 80px;
background-repeat: no-repeat;}
#shadow{border-bottom: 1px solid #333; height: 40px;width: 100%;box-shadow: 0 1px 1px 0 #dfdfdf;}
</style>
</head>
<body>
<p>这是上边的小图片,backgoundsize:是背景图片的大小的设置</p>
<p style="background:blue;width:200px;height:200px;">这是原生图片</p>
<div id="shadow"></div>
</body>
代码中backgound-size就是设置了bodY的背景,只不过背景是张图片,大小:X宽度,Y高度 定死了,并且没有平铺。
backgound-size: perscentage; 百分比表示(父级的)
backgound-size:cover; 把背景图像扩展至足够大,以使背景图像完全覆盖背景区域。背景图像的某些部分也许无法显示在背景定位区域中。
backgound-size:contain; 把图像图像扩展至最大尺寸,以使其宽度和高度完全适应内容区域。
background-origin:border-box;/padding-box/content-box: 内容填充在哪些位置。
bakgound-clip:border-box;/padding-box/content-box: 内容剪切在哪些位置。
background-position:x方向,y方向;{负值则是向相反方向}
下面的网址更详细:
http://www.qianduan.net/everthing-about-css-background/
background-size: 60px 100px;
-moz-background-size:60px 100px;
padding-top: 80px;
background-repeat: no-repeat;}
#shadow{border-bottom: 1px solid #333; height: 40px;width: 100%;box-shadow: 0 1px 1px 0 #dfdfdf;}
</style>
</head>
<body>
<p>这是上边的小图片,backgoundsize:是背景图片的大小的设置</p>
<p style="background:blue;width:200px;height:200px;">这是原生图片</p>
<div id="shadow"></div>
</body>
代码中backgound-size就是设置了bodY的背景,只不过背景是张图片,大小:X宽度,Y高度 定死了,并且没有平铺。
backgound-size: perscentage; 百分比表示(父级的)
backgound-size:cover; 把背景图像扩展至足够大,以使背景图像完全覆盖背景区域。背景图像的某些部分也许无法显示在背景定位区域中。
backgound-size:contain; 把图像图像扩展至最大尺寸,以使其宽度和高度完全适应内容区域。
background-origin:border-box;/padding-box/content-box: 内容填充在哪些位置。
bakgound-clip:border-box;/padding-box/content-box: 内容剪切在哪些位置。
background-position:x方向,y方向;{负值则是向相反方向}
下面的网址更详细:
http://www.qianduan.net/everthing-about-css-background/
相关文章推荐
- css中隐藏元素的使用
- 区分html与css中的属性
- (0829)BOM对象-location-screen-history-navigat、DOM对象-htmlDOM-cssDOM
- 博客园样式个性化
- 编写灵活、稳定、高质量的 HTML 和 CSS 代码的规范。
- CSS设定图片变灰色
- 总结css实现固定和自适应宽度混合的多栏布局实现方法
- 学习笔记 五 css
- CSS 3 概述
- CSS3 icon font完全指南
- CSS display:none和visibility:hidden区别
- css去除页面点击链接、按钮触发的虚线框
- CSS选择器优先级
- HTML/CSS基础
- 使用link标签导入外部样式表
- 关于css的优先级
- css3大段文字分栏布局
- CSS中元素水平居中和垂直居中的方法
- css中单位px和em,rem的区别
- 【笔记】css绘制带三角的气泡