P63-前端基礎CSS-電影卡片練習圖文佈局
阿新 • • 發佈:2021-01-27
技術標籤:最美前端# 前端【H5+Css3】
P63-前端基礎CSS-電影卡片練習圖文佈局
1.概述
通過電影卡片案例,綜合練習背景圖片、文字的樣式設定和佈局。
2.電影卡片案例
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>電影卡片</title>
<link rel="stylesheet" href="./css/reset.css">
<!-- 匯入圖示字型 -->
<link rel="stylesheet" href="./fa/css/all.css">
<style>
/* 設定外層容器 */
.outer {
width: 240px;
margin: 100px auto;
/* 設定陰影 */
box-shadow: 0 0 10px rgba(0, 0, 0, .8);
}
/* 設定圖片 */
.img-wrapper img {
width: 100%;
vertical-align: bottom;
}
/* 設定內容容器 */
.info {
padding: 0px 18px;
color: #acaaaa;
font-size: 14px;
}
.info .title {
color: #717171;
font-size: 18px;
margin: 13px 0 15px 0;
}
.info .category i{
margin-left: 4px;
margin-right: 7px;
}
/* 設定簡介的樣式 */
.info .intro {
margin: 18px 4px;
/* 設定行間距 */
line-height: 20px;
}
/* 設定下邊的內容 */
.star-wrapper {
height: 46px;
line-height: 46px;
border-top: 1px solid #e9e9e9;
color: #ddd;
padding: 0 16px;
}
/* 設定星星的樣式 */
.star-wrapper .star {
float: left;
}
.star-wrapper .light {
color: #b9cb41;
}
.star-wrapper .weibo {
float: right;
}
</style>
</head>
<body>
<!-- 建立一個外層容器 -->
<div class="outer">
<!-- 建立圖片容器 -->
<div class="img-wrapper">
<img src="./img/10/1.jpg" alt="電影卡片">
</div>
<!-- 建立內容區容器 -->
<div class="info">
<h2 class="title">
暴雪公主
</h2>
<h3 class="category">
<!-- 使用圖示字型 -->
<i class="fas fa-map-marker-alt"></i>
Call Me
</h3>
<p class="intro">
Now the queen was the most beautiful woman in all the land,
and very proud of her beauty. She had a mirror,
which she stood in front of every morning
</p>
</div>
<!-- 建立評分的容器 -->
<div class="star-wrapper">
<!-- 建立星星 -->
<ul class="star">
<!-- 使用圖示字型 -->
<li class="fas fa-star light"></li>
<li class="fas fa-star light"></li>
<li class="fas fa-star"></li>
<li class="fas fa-star"></li>
</ul>
<!-- 分享 -->
<ul class="weibo">
<!-- 使用圖示字型 -->
<li class="fab fa-weibo"></li>
</ul>
</div>
</div>
</body>
</html>