I just want that background image would be zoomed, but it covers the header, and overflow: hidden doesn't work

https://jsfiddle.net/space2froggy/7t95nvLy/2/ here is my code.

HTML

<header>
    <div class="logo">
        <img src="resources/logo/logo.svg" class="logo-img" alt="Logo">
    </div>       
    <div class="main-nav">
        <ul>
            <li><a href="#">About me</a></li>
            <li><a href="#">Relationships</a></li>
            <li><a href="#">Requirements</a></li>
            <li><a href="#">Users</a></li>
            <li><a href="#">Sign Up</a></li>
        </ul>
    </div>
    <div class="settings">
        <div class="user-data">
            <h6>Superstar</h6>
            <p>[email protected]</p>
        </div>
        <img src="resources/img/user-superstar-2x.jpg" class="photo-small" alt="User Photo">
        <img src="resources/icons/sign-out.svg" alt="Sign Out" class="sign-out">
    </div>
</header>

<section class="board">
    <h1>Test assignment for Frontend Developer Position</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <a href="#" class="btn btn-full">Sign Up</a>
</section>

CSS

.board {
    background-image: url(img/bg-1.jpg);
    background-size: cover;
    background-position: center;
    transform: scale(2);
    overflow: hidden;
}

1 Answers

0
Bathri Nathan On

Remove transform: scale(2); from the css then it shows fine.

.board {
background-image: url('https://cdn.pixabay.com/photo/2017/08/30/01/05/milky-way-2695569_960_720.jpg');
background-size: cover;
background-position: center;
overflow: hidden;
}

 {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* always at start */
}

html {
    font-family: 'Lato', 'Arial', sans-serif;
    font-size: 20px;
    text-rendering: optimizeLegibility; /*IMP!!!*/
    line-height: 145%;
    max-width: 2560px;
}

header {
    max-width: 1140px;
    margin: 15px auto;
}

header > * {
    display: inline-block;
}

header a {
    text-decoration: none;
    color: #171717;
}

.logo {
    width: 15%;
}

.logo-img {
    width: 150px;
    height: auto;
}

.main-nav {
    font-size: 15px;
    margin-left: 10%;
}

.main-nav ul li {
    float: left;
    list-style: none;
    padding: 0 15px;
}

.settings {
    float: right;
    line-height: 80%;
}

.settings > * { /* to all ONLY child els */
    float: left;
    display: inline-block;
}

.photo-small {
    width: 40px;
    height: auto;
    border-radius: 50%;
}

.user-data {
    padding: 0 10px;
}

.settings h6 {
    float: right;
}

.settings p {
    font-size: 12px;
    color: #a0a0a0;
}

.photo-small {
    margin: -5px 5px;
}

.sign-out {
    margin: 5px 10px;
}


/*//////////////////////////*/
/*////////---BOARD---////////*/
/*//////////////////////////*/

h1 {
    margin: 0;
}
 <header>
        <div class="logo">
            <img src="resources/logo/logo.svg" class="logo-img" alt="Logo">
        </div>       
        <div class="main-nav">
             <ul>
                <li><a href="#">About me</a></li>
                <li><a href="#">Relationships</a></li>
                <li><a href="#">Requirements</a></li>
                <li><a href="#">Users</a></li>
                <li><a href="#">Sign Up</a></li>
            </ul>
        </div>
        <div class="settings">
            <div class="user-data">
                <h6>Superstar</h6>
                <p>[email protected]</p>
            </div>
            <img src="resources/img/user-superstar-2x.jpg" class="photo-small" alt="User Photo">
            <img src="resources/icons/sign-out.svg" alt="Sign Out" class="sign-out">
        </div>
    </header>

    <section class="board">
        <h1>Test assignment for Frontend Developer Position</h1>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
        <a href="#" class="btn btn-full">Sign Up</a>
    </section>