Thursday, 21 April 2022

HTML + CSS #14 | Positions = Fixed , Relative , Sticky , Absolute | HTML & CSS | Web Development

 <!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</title>
</head>
<style>
    .pbox{
        height: 2000px;
    border: 5px solid aqua;
    }
    .box{
        border: 3px solid black;
        height: 100px;
        width: 100px;
        padding: 1px 4px;
        margin: 5px;
        display: inline-block;
    }
    #box1{
        position:relative;
       
    }
    #box3{
        position: sticky;
        border: 5px solid red;
        top: 100px;
        left: 100px;

    }
</style>
<body>
    <div class="pbox">
        <div class="box" id="box1"></div>
        <div class="box" id="box2"></div>
        <div class="box" id="box3"></div>
    </div>
</body>
</html>



No comments:

Post a Comment

JAVASCRIPT + CSS + HTML #42 | Event & Event Listener |How to Target using JS | Web Development

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