欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

html css作业

程序员文章站 2022-04-19 21:27:53
...

根据所给商品图片,做一个类似如下图所示的小米商城的页面

html css作业

想法:

运用上课学的知识,我决定先建一个主盒子,再在主盒子中分左右两个盒子,右边的盒子再分上下两个盒子,里面的八个商品浮动加间距即可。

大致写出来是这个效果

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<style type="text/css">
		a{
			font-size:25px;
		}
		a:link {
			text-decoration:none;
			color: black;
		}

		a:visited {
			text-decoration:none;
			color: black;
		}

		a:hover {
			text-decoration:none;
			color: orange;
		}

		a:active {
			text-decoration:none;
			color: #0000FF;
		}
		.upo{
			font-size: 18px;
			background-color: #ffac13;
			color: white;
			display: block;
			width: 75px;
		}
		.B{
			font-size: 18px;
			font-weight: 800;
		}
		.notB{
			font-size: 18px;
		}
		.bottom{
			font-size: 18px;
			color: orange;
		}
		.upb{
			font-size: 18px;
			background-color: #2196f3;
			color: white;
			display: block;
			width: 75px;
		}
		.back{
			width: 220px;
			height: 302px;
			background: white;
			float: left;
			margin-left:10px;
		}
		.main{
			position:relative;
			width: 1160px;
			margin:0 auto;
		}
		.left{			
			float:left;
		}
		.right{			
			float:left;
		}
		.top,.fotter{
			position:absolute;
			float:left;
			margin-left:5px;
		}
		.top{
		}
		.fotter{
			top:375px;
		}
	</style>
</head>
<body style="background-color:#eee";>
	<div class="main">
		<a href = "#" style="float:right">查看全部</a>
		<h1 style='coler: black'>智能硬件</h1>
		<div class="left">
			<img src="row2Img.jpg" height="614" width="234">
		</div>	
		<div class="right">
			<div class="top">
				<div class="back" align="center">
					<span class="upo">免邮件</span>
					<img src="znyj1.jpg" height="180" 	width="180"><br/>
					<span class="B">小米摄像头</span><br/>
					<span class="notB">高清摄像</span><br/>
					<p class="bottom">300元</p>
				</div>
				<div class="back" align="center">
					<span class="upo">免邮件</span>
					<img src="znyj3.jpg" height="180" 	width="180"><br/>
					<span class="B">玩具娃娃</span><br/>
					<span class="notB">更加柔软,不伤皮肤</span><br/>
					<p class="bottom">98元</p>
				</div>
				<div class="back" align="center">
					<span class="upo">免邮件</span>
					<img src="znyj5.jpg" height="180" 	width="180" ><br/>
					<span class="B">小米小型电动车</span><br/>
					<span class="notB">持久续航,携带方便</span><br/>
					<p class="bottom">888元</p>
				</div>
				<div class="back" align="center">
					<span class="upo">免邮件</span>
					<img src="znyj7.jpg" height="180" 	width="180"><br/>
					<span class="B">防尘口罩</span><br/>
					<span class="notB">有效防止PM2.5</span><br/>
					<p class="bottom">66元</p>
				</div>
			</div>
			<div class="fotter">
				<div class="back" align="center">
					<span class="upb">有赠品</span>
					<img src="znyj2.jpg" height="180" 	width="180"><br/>
					<span class="B">小米手表</span><br/>
					<span class="notB">全国联保</span><br/>
					<p class="bottom">138元</p>
				</div>
				<div class="back" align="center">
					<span class="upb">有赠品</span>
					<img src="znyj4.jpg" height="180" 	width="180"><br/>
					<span class="B">我也不知道是啥</span><br/>
					<span class="notB">又方又圆</span><br/>
					<p class="bottom">300元</p>					
				</div>
				<div class="back" align="center">
					<span class="upb">有赠品</span>
					<img src="znyj6.jpg" height="180" 	width="180"><br/>
					<span class="B">小米台灯</span><br/>
					<span class="notB">光线柔和不伤眼</span><br/>
					<p class="bottom">59元</p>
				</div>
				<div class="back" align="center">
					<span class="upb">有赠品</span>
					<img src="znyj8.png" height="180" 	width="180"><br/>
					<span class="B">我也不知道是啥</span><br/>
					<span class="notB">中间带一个按钮</span><br/>
					<p class="bottom">200元</p>
				</div>
			</div>		
		</div>	
	</body>
	</html>

效果图:

html css作业