css 为什么第一块和第二块之间有一个空格

gijlo24d  于 2023-04-01  发布在  其他
关注(0)|答案(1)|浏览(96)
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
<style>
@font-face {
    font-family: awesome;
    src: url(bluene-html/fonts/FontAwesome.otf);
}

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

html {
    scroll-behavior: smooth;
}

body {
    color: white;
    background-image: url("bluene-html/images/banner.jpg");
    background-repeat: no-repeat;
    font-family: 'Lato', sans-serif;
    
}

input {
    border-style: none;
}

.first-block {
    padding: 50px;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3% 8%;
    margin-bottom: 5%;
}

nav ul {
    display: flex;
    justify-content: space-between;
    list-style-type: none;
}

nav h3 {
    font-size: 3rem;
    font-style: italic;
    font-weight: 700;
}

nav ul li a {
    text-decoration: none;
    color: white;
    transition: .5s;
    padding: 0 40px;
    font-size: 1.5rem;

}

nav ul li a:hover {
    color: rgba(255, 8, 8, 0.849);
}


.start {
    width: 15%;
    height: 0%;
    margin-bottom: 30px;
    margin-top: -60px;
    display: st;
}

.digi {
    text-transform: capitalize;
    font-weight: 900;
    font-size: 70px;
}

.circle-triangle {
    width: 40%;
    z-index: -1;
    float: right;
    position: relative;
    bottom: 43vh;
}

.first-read {
    background-color: white;
    color: rgba(255, 40, 63, 255);
    margin-top: 10%;
    width: 450px;
    height: 100px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: 1s;
}

.first-read:hover {
    background-color: rgba(255, 40, 63, 255);
    color: white;
}

.second-block {
    width: 100%;
    height: 100%;
    padding: 0 5%;
    color: black;
    display: flex;
}

.devices {
    width: 40%;
    grid-area: devices;

}

.full {
    font-size: 4rem;
    font-weight: 700;
    grid-area: full;

}

.sec-lorem {
    color: #514f50;
    line-height: 30px;
    font-size: 1.6rem;
}

.second-right {
    flex-wrap: wrap;
    margin-left: 50px;

}

.sec-read {
    background-color: black;
    color: white;
    margin-top: 2%;
    width: 200px;
    height: 70px;
    font-size: 1rem;
    cursor: pointer;
    transition: 1s;
}

.sec-read:hover {
    background-color: rgba(255, 40, 63, 255);
}

.third-block {
    margin-top: 80px;
    background-color: black;
    color: white;
    display: flex;
    padding: 150px 130px;
    justify-content: space-around;
}

.solutions {
    font-size: 4rem;
    font-weight: 900;
    flex-wrap: wrap;
    padding: 0 280px 0 0;
    line-height: 80px;
    margin-bottom: 40px;
}

.third-lorem {
    font-size: 1.5rem;
    line-height: 40px;
    flex-wrap: wrap;
    padding-right: 150px;
}

.third-read {
    background-color: white;
    color: black;
    margin-top: 5%;
    width: 200px;
    height: 70px;
    font-size: 1rem;
    cursor: pointer;
    transition: 1s;
}

.third-read:hover {
   color: white;
    background-color: rgba(255, 40, 63, 255);
}

.hands {
    width: fit-content;
}
</style>
</head>

<body>

    <header>
        <nav>
            <h3>Bluene</h3>
            <ul>
                <li><a href="#second-block">SERVICES</a></li>
                <li><a href="#">OUR WORK</a></li>
            </ul>
        </nav>
    </header>
    <main>
        <div class="first-block">

            <img src="bluene-html/images/btn.png" alt="" class="start">
            <div class="first-grid"></div>
            <h1 class="digi">
                a digital creative <br>
                agency <br>
                landing page
            </h1>
            <img src="bluene-html/images/bann_img.png" alt="" class="circle-triangle">
            <input class="first-read" type="button" value="READ MORE">
        </div>
        <div class="second-block" id="second-block">
            <img src="bluene-html/images/pc.png" alt="" class="devices">
            <div class="second-right">
                <h2 class="full">
                    Full service digital
                    capbilities From end
                    to end workflow
                    </h3>
                    <p class="sec-lorem">
                        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been
                        the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley
                        of type and scrambled it to make a type specimen book. It has survived not only five
                    </p>
                    <input type="button" value="READ MORE" class="sec-read">
            </div>
        </div>
        <div class="third-block">
            <div class="third-left">
                <h2 class="solutions">
                    Solutions for every
                    Specific need
                </h2>
                <p class="third-lorem">
                    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
                    industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
                    scrambled it to make a type specimen book. It has survived not only five
                </p>
                <input type="button" value="Read More"
                class="third-read">
            </div>
            <div class="third-right">
                <img class="hands" src="bluene-html/images/solusan.png" alt="">
            </div>
        </div>
    </main>
</body>

</html>

这可能是我第一次在这里问,我是一个乞丐,我正在为css和html的模板做一个翻拍,一切都很好,但我不知道为什么第一个块和第二个块之间有一个空间。

1cosmwyk

1cosmwyk1#

那是因为

.first-block {
    padding: 50px;
}

这个CSS样式块指定目标元素的所有边(顶部,右侧,底部和左侧)都应该有50px的填充。
如果你不想在下面,你可以这样做

.first-block {
  padding-top: 50px;
  padding-right: 50px;
  padding-left: 50px;
}

相关问题