Creating gradient layout using css grid

HTML CODE

<body>
        <div class="container">
            <div class="box box1">Box 1</div>
            <div class="box box2">Box 2</div>
            <div class="box box3">Box 3</div>
            <div class="box box4">Box 4</div>
            <div class="box box5">Box 5</div>
            <div class="box box6">Box 6</div>
            <div class="box box7">Box 7</div>
        </div>

</body>


CSS CODE

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

.container{
    display: grid;
    height: 100vh;
    grid-template-columns: repeat(3,1fr) 200px;
    grid-template-rows: 100px 200px repeat(1,1fr) 100px;
    gap: 1rem;
    padding: 1rem;
}

.box{
    border-radius: 2rem;
}

.box1{
    grid-column: span 4;
    background:linear-gradient(120deg,#FF4E50,#F9D423);
    /* --------------to bring text center ------------------- */
    display: flex;
    justify-content: center;
    align-items: center;
}

.box2{
    background: linear-gradient(120deg,#B993D6,#8CA6DB);
    /* --------------to bring text center ------------------- */
    display: flex;
    justify-content: center;
    align-items: center;
}
.box3{
    background: linear-gradient(120deg,#16A085,#F4D03F);
    /* --------------to bring text center ------------------- */
    display: flex;
    justify-content: center;
    align-items: center;
}
.box4{
    background: linear-gradient(120deg,#e65c00,#F9D423);
    /* --------------to bring text center ------------------- */
    display: flex;
    justify-content: center;
    align-items: center;
}


.box5{
    grid-row: span 2;
    background:linear-gradient(120deg,#00d2ff,#3a7bd5);
    /* --------------to bring text center ------------------- */
    display: flex;
    justify-content: center;
    align-items: center;
}

.box6{
    grid-column: span 3;
    background:linear-gradient(120deg,#f2709c,#ff9472);
    /* --------------to bring text center ------------------- */
    display: flex;
    justify-content: center;
    align-items: center;

}

.box7{
    grid-column: span 4;
    background:linear-gradient(120deg,#DA22FF,#9733EE);
    /* --------------to bring text center ------------------- */
    display: flex;
    justify-content: center;
    align-items: center;
}

Comments

Popular posts from this blog

CSS simple grid layout

Gsap timeline position parameters

GSAP Timelines