css背景图-精灵图应用

精灵图:

 

html代码:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/财神.css"/>
	</head>
	<body>
		<div class="box">
			<div class="box1">
				<span class="s1"></span>
				<div class="box2">
					您尚未登录<br />
					登录可关注更过信息
				</div>
			</div>
			<div class="box3">
				<table border="0" rules="0" cellspacing="10px" cellpadding="0">
					<tr style="height: 35px;">
						<td align="right" width="135px">
							<input class="in1" type="button" value="登 录" />
						</td>
						<td width="135px">
							<input class="in2" type="button" value="注 册" />
						</td>
					</tr>
				</table>
			</div>
			<div class="box4">
				<span class="s2"></span>
				QQ登录
				<span class="s3"></span>
				微信登录
				<span class="s4"></span>
				微博登录
			</div>
		</div>
	</body>
</html>

css样式:

.box{
	width: 270px;
	height: 180px;
	background-color: #f7f7f7;
	margin: auto;
}
.box1{
	height:80px;
}
.box2{
	width: 175px;
	margin-top: 25px;
	font-size: 15px;
	float: right;
	letter-spacing: 1px;
}
.s1{
	display: inline-block;
	width: 67px;
	height: 67px;
	background: url(../img/财神.png) no-repeat;
	margin-left: 18px;
	margin-top: 13px;
	float: left;
}
.box4{
	margin-top: 5px;
	font-size: 13px;
	color: #003398;
}
.s2{
	display: inline-block;
	width: 12px;
	height: 14px;
	background: url(../img/sprite.png) no-repeat;     /* 引入图片,并设置平铺不重复*/
	background-position:-468px -308px ;               /* 以精灵图的左上角坐标原点,右边为X轴 
                                                         的正方向,下边为Y轴的正方向,通过调节 
                                                         X,Y值来实现图片的呈现*/
	margin-left: 20px;
	vertical-align: bottom;
}
.s3{
	display: inline-block;
	width: 17px;
	height: 14px;
	background: url(../img/sprite.png) no-repeat;
	background-position:-649px -162px ;
	margin-left: 5px;
	vertical-align: bottom;
}
.s4{
	display: inline-block;
	width: 17px;
	height: 15px;
	background: url(../img/sprite.png) no-repeat;
	background-position:-671px -162px ;
	margin-left: 5px;
	vertical-align: bottom;
}
.in1{
	width: 110px;
	height:35px;
	background-color: #ea5404;
	border: none;
	font-size: 15px;
	color: #ffffff;
}
.in2{
	width: 110px;
	height:35px;
	background-color: #ffffff;
	border-color: #1a92fd;
	font-size: 15px;
	color: #44a5fc;

效果图:

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值