CSS : Position, absolute, relative ,fixed and sticky(tut25).html

CSS : Position, absolute, relative ,fixed and sticky(tut25).html


<!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>Document</title>
    <style>
         .box{
            display: inline-block;
            border: 2px solid red;
            width: 150px;
            height: 150px;
            margin: 2px;
        }
        #box3
    {
       /* relative: Position to the element relative to its normal position and will give a gap at its normal position*/
       /*positive: relative */
       /* top: 34px;
       left: 134px; */
       /* absolute: Position to the element absolute to the position of its first parent and will not give a gap at its normal posotion */
            /* position: absolute; */

            /* fixed: Position to the element relative browser window */
            /* position: fixed; */
            /* right: 4px;
            bottom: 2px; */

            /* sticky:  */
            position: sticky;
            top: 3px;

    }
        .container{
            border: 2px solid red;
            background-color: blue;
            height: 34444px;
        }
       
        /* CSS Position:staic(default),absolute,relative,fixed,sticky */
   
    </style>
</head>
<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">4</div>

</div>
 

</body>
</html>

Comments

Popular posts from this blog

automation fitness center project synopsis

Document.html