css布局练习

要实现的效果:
在这里插入图片描述
提供的图片素材有:
在这里插入图片描述
就是让前面的标题小图片和后面的文字标题一一对应起来

代码如下:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.one{
				width: 300px;
				color: rgb(255,254,250);
				background-color: rgb(81,134,0);
				height: 30px;
				line-height: 30px;
				text-indent: 16px;
			}
			.two{
				width: 300px;
				height: 360px;
				background-color: rgb(242,244,223);
					
			}
			
			ul{
				margin: 0;
				padding-top: 10px;
				/*ul列表去序号*/
				list-style: none;
			}
			
			li{
				/*垂直方向居中*/
				line-height: 30px; 
				background-repeat: no-repeat;
				background-position: 0px center;
				text-indent: 30px;
			}
			li:nth-of-type(1){
							background-image: url(img/book_no01.gif);
						}
						li:nth-of-type(2){
							background-image: url(img/book_no02.gif);
						}
						li:nth-of-type(3){
							background-image: url(img/book_no03.gif);
						}
						li:nth-of-type(4){
							background-image: url(img/book_no04.gif);
						}
						li:nth-of-type(5){
							background-image: url(img/book_no05.gif);
						}
						li:nth-of-type(6){
							background-image: url(img/book_no06.gif);
						}
						li:nth-of-type(7){
							background-image: url(img/book_no07.gif);
						}
						li:nth-of-type(8){
							background-image: url(img/book_no08.gif);
						}
						li:nth-of-type(9){
							background-image: url(img/book_no09.gif);
						}
						li:nth-of-type(10){
							background-image: url(img/book_no10.gif);
						}

			a{
				/*超链接去下划线*/
				text-decoration: none;
				color: rgb(38,90,165);
			}
		</style>
	</head>
	<body>
		<div class="one">
			畅销书排行榜 <img align="absmiddle" src="img/bang.gif"/>
		</div>
		
		<div class="two">
			<ul>
				<li><a href="">不抱怨的世界(...</a></li>
				<li><a href="">遇见未知的自己...</a></li>
				<li><a href="">活法(季羡林、...</a></li>
				<li><a href="">高效能人士的七个习惯</a></li>
				<li><a href="">被迫强大(北外女生香奈儿...</a></li>
				<li><a href="">遇见心想事成的自己(《遇...</a></li>
				<li><a href="">世界上最伟大的推销员(插...</a></li>
				<li><a href="">我的成功可以复制(唐骏亲...</a></li>
				<li><a href="">少有人走的路:心智成熟的...</a></li>
				<li><a href="">活出全新的自己——唤醒...</a></li>
			</ul>
		</div>
	
	</body>
</html>

页面效果如下:
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值