背景

一、背景设置基础

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>背景</title>
	<style type="text/css">
		div {
				width: 400px;
				height: 500px;
				background-color: purple;
				background-image: url(btn.png);
				background-repeat: no-repeat;不平铺
				background-position: x y; top bottom left right center
				background-position: center center;
				/* background-position :
					1、后可跟方位名词,没有先后顺序;
					2、如果只写一个方位名词,另一个默认值是居中center;
					3、后也可跟 值px;但是必须有顺序,即第一个参数是x,第二个参数是y */
				background-position: bottom;
				background-position: left;
				background-position: 12px 50px;
				background-position: 50px 12px;
				background-position: 10px center;
				background-attachment: fixed;		
			 /* background: 背景颜色 背景图片地址 背景平铺 背景滚动 背景位置 */
			 /* background: #000 url(btn.png) no-repeat fixed center top; */
		}
	</style>
</head>
<body>
	<div></div>
</body>
</html>

二、背景半透明

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		body {
			background-color: pink;
		}

		div {
			width: 200px;
			height: 200px;
			/* background-color: #000; */
			color: #fff;
			background-color: rgba(0,0,0,0.3);/* red green blue alpha(透明度) */
		}
	</style>
</head>
<body>
	<div>文字内容</div>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值