0
点赞
收藏
分享

微信扫一扫

advanced-css: No.1

天蓝Sea 2023-11-12 阅读 37
css前端

案例

在这里插入图片描述

HTML:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        
        <link href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900" rel="stylesheet">

        <link rel="stylesheet" href="css/icon-font.css">
        <link rel="stylesheet" href="css/style.css">
        <link rel="shortcut icon" type="image/png" href="img/favicon.png">
        
        <title>Natours | Exciting tours for adventurous people</title>
    </head>
    <body>
        <header class="header">
            <div class="logo-box">
                <img src="img/logo-white.png" alt="Logo" class="logo">
            </div>
            <div class="text-box">
                <h1 class="heading-primary">
                    <span class="heading-primary-main">outdoors</span>
                    <span class="heading-primary-sub">is where life happiness</span>
                </h1>
            </div>
        </header>
    </body>
</html>

CSS:

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Lato", sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    color: #777;
    padding: 30px;
}

.header {
    height: 95vh;
    background-image: linear-gradient(to right bottom, rgba(128, 214, 113, 0.804), rgba(39, 180, 133, 0.8)), url(../img/hero.jpg);
    background-size: cover;
    background-position: top;
    clip-path: polygon(0 0, 100% 0, 100% 80%, 0 100%);
    position: relative;
}


.logo-box {
    position: absolute;
    top: 40px;
    left: 40px;
}

.logo {
    width: 80px;
}

.text-box {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
}

.heading-primary {
    color: #fff;
    text-transform: uppercase;
}

.heading-primary-main {
    display: block;
    font-size: 60px;
    font-weight: 700;
    letter-spacing: 30px;
}

.heading-primary-sub {
    display: block;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 15.7px;
}

相关知识

clip-path
举报

相关推荐

0 条评论