css 背景图片相关属性

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			img{
				border: 22px solid red;
				height: 300px;
				width: 300px;
				background:url(../images/cbd.jpg) no-repeat;
				padding: 50px;
				/* 保证背景图片最大化的在盒子中等比例显示,但不保证能铺满盒子*/
				/*background-size: contain;*/
				
				/* 百分比*/
				/*background-size:50% 50%;*/
				
				/* cover 会保证完全覆盖盒子,但不能保证完整显示*/
				background-size:cover;
				
				/* 设置背景原点*/
				/* 占用padding*/
            	/*background-origin: padding-box;*/
	            /* 占用border*/
	            /*background-origin: border-box;*/
	            /* 不占用 border和padding*/
	            /*background-origin: content-box;*/
	            
            	/* 背景裁剪*/
	            /*background-clip:border-box;*/
	            /*background-clip:padding-box;*/
	            /*background-clip:content-box;*/
	            
	            /*background: url(images/bg1.png) no-repeat left top
                        ,url(images/bg2.png) no-repeat right top
                        ,url(images/bg3.png) no-repeat right bottom
                        ,url(images/bg4.png) no-repeat left bottom
                        ,url(images/bg5.png) no-repeat center;*/
                        
			}
		</style>
	</head>
	<body>
		
		
		<div>
			<img src="" alt="" />
		</div>
	</body>
</html>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值