position in css

technical talkiess
0

 In this article you show the position in css


<!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>Position in css</title>
</head>
<style>
    .container{
        height: 3443px;
    }
    .box{
        width: 120px;
        background-color: grey;
        border: 1 px solid red;
        margin: 2px;
        display: inline-block;
        height: 100px;
        color: white;
    }
    #box9{
        /* fix the dive  */
        position: fixed;
        bottom: 2px;
        background-color: red;
        right: 2px;
    }
    #box7{
        /* gap the original position */
        position: relative;
        top: 20px;
        background-color: red;
        left: 20px;
    }
    #box6{
        /* position according the parent div */
        position: absolute;
        top: 50px;
        background-color: red;
        left: 20px;
    }
    #box4{
        /* stick the line never scroll up */
        position: sticky;
        top: 10px;
        background-color: red;
        /* left: 20px; */
    }
</style>
<body>
    <div class="container">
        <div class="box" id="box1">1</div>
        <div class="box" id="box2">2</div>
        <div class="box" id="box3">3</div>
        <div class="box" id="box4">Sticky</div>
        <div class="box" id="box6">relative</div>
        <div class="box" id="box7">Relative</div>
        <div class="box" id="box8">4</div>
        <div class="box" id="box9">Fixed</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)