Sunday, 6 March 2022

TUT24(Position: Absolute, sticky, relative etc)

<!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></title>
    <style>
        .Container {
            border: 2px solid black;
            background-color: khaki;
            height: 3444px;
        }

        /* CSS Position: Static (default), relative,absolute, fixed, sticky */
        .box {
            display: inline-block;
            border: 2px solid red;
            width: 150px;
            height: 150px;
            margin: 2px;

        }

        #box3 {
            /* relative: Positions the element relative to its normal position and will leave a gap its nomal position */
            /* position: relative; */

            /* absolute: Positions the element relative to the position of its first parent */
            /* position: absolute; */

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

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


        }
    </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">Chat with us</div>
        <div class="box" id="box4">4</div>
    </div>
</body>

</html>


No comments:

Post a Comment

TUT 44 (CSS GRID - 3)

  <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < met...