Применение margin-top к div перемещает весь контент - PullRequest
0 голосов
/ 09 июля 2020

У меня есть простая страница в html и css, и я пытаюсь сделать pu sh my div second-section вниз на 50 пикселей, используя свойство margin-top, но по какой-то причине он не перемещается и вместо этого перемещает весь content div. Почему и как я могу его опустить?

* {
    padding: 0px;
    margin: 0px;
}

.nav {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 50%;
}

.header {
    height: 8%;
}

.nav-h1 {
    text-align: center;
    margin-top: 27px;
    font-size: 40px;
}

a {
    display: inline-block;
    margin: 10px;
    font-family: 'Segoe UI', sans-serif;
    font-family: SegoeUI;
    font-size: 16px;
    font-weight: bold;
    color: black;
    font-weight: bold;
}

.a-container {
    margin-left: 10%;
    margin-top: 27px;
}

.footer {
    background-color: #e8e8e8;
    height: 288px;
    width: 100%;
}

.alignleft {
    float: left;
    margin-left: 8%;
    font-family: SegoeUI;
    font-size: 18px;
    font-weight: 900;
    color: #000000;
}

.alignright {
    float: right;
    margin-right: 8%;
    display: flex;
    flex-direction: row;
}

.logo-section {
    margin-top: 1.3%;
    margin-left: 2%;
}

.logo-img {
    padding: 6px;
}

.first-section {
    width: 100%;
    background-image: url("/assets/images/first-image.png");
    background-repeat: no-repeat;
    background-size: contain;
    position: relative;
    float: left;
}

.first-section-p {
    width: 400px;
    height: 314px;
    margin-left: 10%;
    padding-top: 10%;
    font-family: SegoeUI;
    font-weight: 900;
    font-size: 4vh;
    font-weight: 900;
    text-align: center;
    color: #262262;
}

.small-button {
    width: 331px;
    height: 92px;
    margin-left: 12%;
    background-color: #e7af17;
    font-family: SegoeUI;
    font-size: 18px;
    font-weight: 900;
    color: white;
    border: none;
}

.second-section-text {
    color: #e8e8e8;
    font-weight: 900;
    font-size: 70px;
    line-height: 0.7;
    font-family: SegoeUI;
    margin-left: 12%;
}

.content {
    height: 100%;
}

@media (min-width: 1281px) {
    .first-section {
        width: 100%;
        height: 800px;
        background-image: url("/assets/images/first-image.png");
        background-repeat: no-repeat;
        background-size: cover;
    }
    .small-button {
        width: 331px;
        height: 92px;
        margin-top: 8%;
        margin-left: 12%;
        background-color: #e7af17;
        font-family: SegoeUI;
        font-size: 18px;
        font-weight: 900;
        color: white;
        border: none;
    }
}

@media (min-width: 940px) {
    .small-button {
        width: 331px;
        height: 92px;
        margin-top: 8%;
        margin-left: 12%;
        background-color: #e7af17;
        font-family: SegoeUI;
        font-size: 18px;
        font-weight: 900;
        color: white;
        border: none;
    }
}

.second-section {
    margin-top: 100px;
}
<div class="main-container">
        <div class="headers">
            <div class="nav">
                <h1 class="nav-h1">Logo</h1>
                <div class="a-container">
                    <a>About</a>
                    <a>Vision</a>
                    <a>Solutions</a>
                    <a>Technology</a>
                    <a>Contact</a>
                </div>
                <div class="logo-section">
                    <img class="logo-img" src="/assets/images/facebook.png" alt="facebook logo">
                    <img class="logo-img" src="/assets/images/linkedin.png" alt="linkedin logo">
                </div>
            </div>
        </div>
        <div class="content">
            <div class="content-inside">
                <div class="first-section">
                    <p class="first-section-p">Turnkey platforms <br> for businesses looking to rule the online market
                        <button class="small-button">LEARN MORE</button>
                    </p>
                </div>
                <div class="second-section">
                    <p class="second-section-text">WHAT</p>
                    <p class="second-section-text">WHE DO</p>
                    <p class="second-section-text">BEST</p>
                </div>
            </div>
        </div>
        <div class="footer"></div>
    </div>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...