media query in css

technical talkiess
0

 <!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>media query in css </title>
</head>
<style>
    .box{
        display: none;
        background-color: red;
        font-size: 40px;
        color: white;
    }
    @media only screen and (min-width:300px) and (max-width:500px) {
        #box-1{
            display: block;
            color: black;
            background-color: yellow;
        }
    }
//only screen allow to show in the only screen
    @media only screen and (min-width:500px) and (max-width:800px) {
        #box-2{
            display: block;
            color: black;
            background-color: green;
        }
    }
    @media only screen and (min-width:800px) and (max-width:1200px) {
        #box-3{
            display: block;
            color: black;
            background-color: greenyellow;
        }
    }
    @media only screen and (min-width:1200px){
        #box-4{
            display: block;
            color: black;
            background-color: pink;
        }
    }
</style>
<body>
    <div class="container">
        <div class="box" id="box-1">This is first box</div>
        <div class="box" id="box-2">This is Second box</div>
        <div class="box" id="box-3">This is Third box</div>
        <div class="box" id="box-4">This is four box</div>
    </div>
   
</body>
</html>

Post a Comment

0Comments

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

Post a Comment (0)