CSS学习笔记(2)背景/边框/外延/填充

参考文献: 《HTML, CSS, JavaScript 整合详解》 王津涛 编著,机械工业出版社


1.     CSS背景属性,包括背景颜色、背景图片、背景图片重复等

背景属性

属性值

说明

CSS版本

兼容性

background

background-color

background-image

background-repeat

background-attachment

background-position

设置背景,复合属性

CSS1

IE 4

NS 6

F 1

background-

attachment

scroll

fixed

背景图片是否随网页内容滚动

CSS1

IE 4

NS 6

F 1

background-

color

color

transparent

背景颜色

CSS1

IE 4

NS 4

F 1

background-

image

url

none

背景图片

CSS1

IE 4

NS 6

F 1

background-

position

top left

top center

top right

center left

center center

center right

bottom left

bottom center

bottom right

x-% y-%

x-pos y-pos

背景图片位置

CSS1

IE 4

NS 6

F 1

background-

repeat

repeat

no-repeat

repeat-x

repeat-y

图片是否重复或如何重复

CSS1

IE 4

NS 4

F 1

IE(Internet Explorer);N(Netscape);F(Firefox)

①     background属性,设置网页背景,复合属性,语法格式为:

选择器 { background : background-color |background-image | background-repeat | background-attachment |background-position }

如:

②     background- attachment属性,设置图片是否随网页内容滚动,语法格式为:

选择器 { background- attachment : scroll |fixed }

l  scroll 图片随网页内容滚动

l  fixed 图片在网页中固定不动

③     background- color属性,设置网页元素背景颜色,语法格式为:

选择器 { background- color: color | transparent}

l  color 值可以为颜色名(如<hrcolor=red>)、十六位进制的颜色值(如<hr color=#FF000)、RGB混合模式(如<hr color=rgb(255,0,0))

l  transparent 设置背景颜色为透明,该属性默认

④     background- image属性,设置网页元素背景图片,语法格式为:

选择器 { background- image : none | url }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值