如何 - 個人資料卡
瞭解如何使用 CSS 建立個人資料卡。
如何建立個人資料卡
步驟 1) 新增 HTML
示例
<!-- 新增圖示庫 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="card">
<img src="img.jpg" alt="約翰" style="width:100%">
<h1>約翰·多伊</h1>
<p class="title">執行長兼創始人,示例</p>
<p>哈佛大學</p>
<a href="#"><i class="fa fa-dribbble"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-linkedin"></i></a>
<a href="#"><i class="fa fa-facebook"></i></a>
<p><button>聯絡</button></p>
</div>
步驟 2) 新增 CSS
示例
.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
max-width: 300px;
margin: auto;
text-align: center;
}
.title {
color: grey;
font-size: 18px;
}
button {
border: none;
outline: 0;
display: inline-block;
padding: 8px;
color: white;
background-color: #000;
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
}
a {
text-decoration: none;
font-size: 22px;
color: black;
}
button:hover, a:hover {
opacity: 0.7;
}
自己動手試一試 »