純HTML + CSS製作個人資料卡

總體預覽:

材料:背景圖與頭像.jpg

IDE:VS Code

外部鏈接:CDN加速的font-awesome圖標

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">

HTML部分:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>about</title>
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
    <link rel="stylesheet" href="css/about.css">
</head>

<body>
    <div class="profile-card">
        <div class="card-header">
            <div class="pic">
                <img src="images/pic.jpg" alt="">
            </div>
            <div class="name">RioTian</div>
            <div class="desc">Student & Pokémon Trainer</div>
            <div class="sm">
                <a href="#" class="fab fa-facebook-f"></a>
                <a href="#" class="fab fa-twitter"></a>
                <a href="#" class="fab fa-github"></a>
                <a href="#" class="fab fa-youtube"></a>

            </div>
            <a href="#" class="contract-btn">Contact Me</a>
        </div>
        <div class="card-footer">
            <div class="numbers">
                <div class="item">
                    <span>120</span>
                    posts
                </div>
                <div class="border"></div>
                <div class="item">
                    <span>127</span>
                    Following
                </div>
                <div class="border"></div>
                <div class="item">
                    <span>120K</span>
                    Followers
                </div>
            </div>
        </div>
    </div>
</body>

</html>

CSS部分:

/* Google fonts */
@import url('//fonts.googleapis.com/css?family=Poppins:300,400,500,600,700&display=swap');
@import url('//fonts.googleapis.com/css2?family=Orbitron&display=swap');
@import url('//fonts.googleapis.com/css2?family=Langar&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    text-decoration: none;
}

body {
    height: 100vh;
    background: url(../images/bg.jpg) no-repeat center;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-card {
    width: 400px;
    text-align: center;
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    background: #2c3a47;
    padding: 60px 40px;
}

.pic {
    display: inline-block;
    padding: 8px;
    background: linear-gradient(130deg, #74b9ff, #e66767);
    margin: auto;
    border-radius: 50%;
    background-size: 200% 200%;
    animation: animated-gradient 2s linear infinite;
}

@keyframes animated-gradient {
    25% {
        background-position: left bottom;
    }

    50% {
        background-position: right bottom;
    }

    25% {
        background-position: right top;
    }

    50% {
        background-position: left top;
    }
}

.pic img {
    display: block;
    width: 100px;
    height: 100px;
    border-radius: 50%;
}

.name {
    color: #f2f2f2;
    font-size: 28px;
    font-weight: 600;
    margin: 10px 0;
}

.desc {
    font-size: 18px;
    color: #e66767;
}

.sm {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.sm a {
    color: #f2f2f2;
    width: 57px;
    font-size: 22px;
    transition: .3s linear;
}

.sm a:hover {
    color: #e66767;
}

.contract-btn {
    display: inline-block;
    padding: 12px 50px;
    color: #e66767;
    border: 2px solid #e66767;
    border-radius: 6px;
    margin-top: 16px;
    transition: .3s linear;
}

.contract-btn:hover {
    background: #e66767;
    color: #f2f2f2;
}

.card-footer {
    background: #f4f4f4;
    padding: 60px 10px;
}

.numbers {
    display: flex;
    align-items: center;
}

.item {
    flex: 1;
    text-transform: uppercase;
    font-size: 13px;
    color: #e66767;
}


.item span {
    display: block;
    color: #2c3a47;
    font-size: 30px;
}

.border {
    width: 1px;
    height: 30px;
    background: #bbb;
}