CSS背景

1.背景色

使用 background-color属性为元素设置背景色

如果希望背景色从元素中的文本向外少有延伸,只需增加一些内边距

<style type = "text/css">
	p{
		background-color: rgb(0,255,255);
		padding:20px;
	}
</style>

颜色表达的方式:

 rgb(1,1,1)

#00ffff

red(提供的常量)

可以为所有元素设置背景色,默认值为transparent:透明,

2.背景图像

使用background-image属性。默认值为none

<style type = "text/css">
	body{
		background-image: url("./img/2.png");
	}
</style>

3.背景重复

background-repeat

4.背景定位

background-position :center;

5.背景关联

background-attachment :fixed;










评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值