当前位置: 首页 > 图文教程 > 网页制作 > CSS样式表 > CSS教程:背景background属性应用

CSS样式表
做网页中需要掌握的八个CSS布局技巧
CSS属性 - white-space 空白属性使用说明
用CSS构建iframe效果代码
用div+css解决出现水平滚动条问题
ul在Firefox和IE下的不同表现的解决方法
用css实现隐藏文本框
css实现行间距效果
研究了一下div+css的高度自适应问题
做网页字体大小参考 网页中同字号字体的不同单位对比列表
css 之 background-position-x
css实现兼容各个浏览器的技巧的代码
css中的行间距的代码
HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth完全详解
scrollWidth,clientWidth与offsetWidth的区别
大家需要掌握的 html下SPAN和DIV的区别
布局用CSS+DIV的优点总结
纯CSS生成抗锯齿圆角的代码
IE6,IE7和firefox对DIV的支持区别
DIV+CSS布局的网站对网站SEO的影响分析
非常不错的关于IE与FireFox的js和css几处不同点[转自星火燎原]

CSS样式表 中的 CSS教程:背景background属性应用


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 148 ::
收藏到网摘: n/a


                         背景background:background-image:url("图片的网址");背景图background: url(" 图片的网址 "); 背景.background-color:#色码;背景色彩.              背景background
css说明
background-image:url("图片的网址");背景图
background:url("图片的网址");背景
background-color:#色码;背景色彩
Exp:
background-image:url(背景图案.jpg,gif,bmp);
background-color:#FFFFFF;
background-color:transparent;<--设定背景为透明色
--------------------------------------------------------------------------------
background-repeat改变背景图片的重复并排的设定
css
说明
repeat背景图片并排
repeat-x背景图片以X方向并排
repeat-y背景图片以Y方向并排
no-repeat背景图片不以并排的方式处理
Exp:
background-image:url("http://www.ruanchen.com/x.gif");
background-repeat:no-repeat;
以http://www.ruanchen.com/x.gif这张图片为背景,当图片大小不够的时候,不并排重复
--------------------------------------------------------------------------------
background-attachment是否固定图片位置
css
说明
scroll拉动卷轴时,背景图片会跟着移动(缺省值)
fixed拉动卷轴时,背景图片不会跟着移动
Exp:
background-image:url("http://www.ruanchen.com/x.gif");
background-repeat:no-repeat;
background-attachment:fixed;
以http://www.ruanchen.com/x.gif背景图片不重复并列,且不随卷轴移动
--------------------------------------------------------------------------------
以长度定位background-position:xy
使用百分比定位background-position:x%y%
css
说明
x%往右移
y%往下移
backgroud-position:0%0%;左边上方
backgroud-position:0P%;左边中间
backgroud-position:50%0%;中间上方
backgroud-position:50P%;正中间
backgroud-position:100%0%;右边上方
backgroud-position:00%;左边下方
backgroud-position:100P%;右边中间
backgroud-position:500%;中间下方
backgroud-position:1000%;右边下方
以关键字定位
关键字说明
top上(y=0)
center中(x=50,y=50)
bottom下(y=100)
left左(x=0)
Exp:
background-position:center;
图片在指定背景中央X=50%Y=50%位置
background-position:200px30px