1. 程式人生 > >html+css 實現簡單的列表

html+css 實現簡單的列表

實現效果


結構

<div id="f_list" class="list">
			<div class="list-item">
				<div class="img_box">
					<img class="lazy" data-original="http://img.ejyfile.com/format_img/1463017443.png!500" src="http://img.ejyfile.com/format_img/1463017443.png!500" style="">
					<span class="prices">128.00</span>
					<span class="dot">
						<img class="icon" src="../img/img1/btn_shoucang.png">
						<span class="num">0</span>
					</span>
				</div>
				<div class="info">
					<h3>蘇州石公山、明月灣、古樟園一日自駕遊</h3>
					<div class="detail">
						<span class="line">南京-->蘇州</span>
						出發時間:
						<span class="time">2017-12-02</span>
						共
						<span class="total">1</span>
						天
					</div>
					<div class="tag">
						<span class="tag-items">踏青旅遊</span>
						<span class="tag-items">古鎮園林</span>
						<span class="tag-items">親子活動</span>
						<span class="volume_temp">已售:3</span>
					</div>
				</div>
			</div>
		</div>
樣式
*{
	margin: 0;
	padding: 0;
}
body,html{
	background-color: #eee;
}
ul,li{
	list-style: none; /*列表樣式:無。*/
	list-style-type: none;/*列表無標記*/
}
a,a:active,a:focus,a:hover{
	text-decoration: none; /* 文字修飾:無 */
	color: inherit;/*inherit 關鍵字指定一個屬性應從父元素繼承它的值。*/
}
input{/*內邊距和邊距不再會增加它的寬度*/
	-webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
/*重置表格元素*/
table{
	border-collapse: collapse;
	border-spacing: 0;
}

/*線路列表*/
.list{
	width: 100%;
}

.list-item{
	width: 100%;
	height: 300px;
	background-color: white;
}

.img_box{
	width: 100%;
	height: 200px;
	position: relative;
}

.lazy{
	width: 100%;
	height: 200px;	
}

.prices::before{
	content: "¥";
}
.prices{
	position: absolute;
	bottom: 16px;
	left: 16px;
	color: white;
	font-size: 18px;
	background-color: rgba(0,0,0,0.2);
}
.prices::after{
	content: "起";
}
.dot{
	position: absolute;
	bottom: 16px;
	right: 16px;
	color: white;
	background-color: rgba(0,0,0,0.2);
}

.icon{
	height: 30px;
	vertical-align: middle;
	position: relative;
	bottom: 2px;
	left: 5px;
}

.info{
	width: 100%;
	padding: 10px 0 0 6px;
}

.info>h3{
	font-size: 16px;
	font-weight: 500;
}

.detail{
	margin: 10px 0;
	font-size: 14px;
	color: #999;
}

.tag-items{
	display: inline-block;
	height: 20px;
	line-height: 20px;
	padding: 2px 10px;
	color: #CCB68A;
    background-color: #F3EEE0;
    border-radius: 10px;
    font-size: 14px;
}

.volume_temp{
	float: right;
	margin-right: 10px;
	color: #999;
}