0

https://www.w3schools.com/css/tryit.asp?filename=trycss_position_relative

<!DOCTYPE html>
<html>
<head>
<style>
    #two
        {
            color: red;
            top:   5px;
            left:  5px;
            position: relative;
        }
</style>
</head>
<body>

    <div class = "parent">
            <div class = "child"> One </div>
            <div class = "child" id = "two"> Two </div>
            <div class = "child"> Three </div>
        </div>
    
</body>
</html>

This moves #two child a bit away, but when I change relative to sticky, #two child doesn't move anywhere.

What is it supposed to do with sticky? I thought sticky moves like relative but sticks at the time of scrolling.

Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
  • *I thought sticky moves like relative but sticks at the time of scrolling.* --> you are wrong, this is not how sticky i supposed to work. Read the duplicates to understand sticky – Temani Afif Jun 24 '20 at 08:05

1 Answers1

-1

'sticky' use for stick a object(tag) to a place (top, right, left, bottom ,...)

foad abdollahi
  • 1,733
  • 14
  • 32