Grid auto fit property

technical talkiess
0

 Grid auto fit property

Responsive layout in the grid system


<!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>auto fit in grid</title>
</head>
<style>
    .container{
        display: grid;
        padding: 20px;
        grid-template-columns: repeat(auto-fit,minmax(300px,1fr));
    }
    .box{
        margin: 2px;
        border: 1px solid black;
        /* width:400px; */
        background-color: rgb(4, 60, 243);
        color: white;
    }
</style>
<body>
    <div class="container">
        <div class="box">item - 1</div>
        <div class="box">item - 2</div>
        <div class="box">item - 3</div>
        <div class="box">item - 4</div>
        <div class="box">item - 5</div>
        <div class="box">item - 6</div>
        <div class="box">item - 7</div>
        <div class="box">item - 8</div>
        <div class="box">item - 9</div>
        <div class="box">item - 10</div>
    </div>
</body>
</html>
Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)