Home > Enterprise >  I am trying to make this div move with me when I scroll down but its not working
I am trying to make this div move with me when I scroll down but its not working

Time:06-21

I have this div in my home page and I want it to move with me when I scroll

<div className="linkss">
        <h3>/ Links</h3>
        <a href="https://www.etsy.com/ca/shop/VanillaUnlimited">/ Etsy Shop </a>
        <a href="https://www.etsy.com/ca/shop/VanillaUnlimited">/ LinkedIn </a>
        <a href="https://www.etsy.com/ca/shop/VanillaUnlimited">/ Instagram </a>
</div>

this is the css I have for it and I read that if you add position fixed it should move with me but its not moving its stuck where it is

.linkss{
    
    color: #8892b0;
    font-family: 'NTR', sans-serif;
    font-size: 25px;
    right: 10px;
    top: 680px;
    padding-right: 30px;
    position: fixed;
}

.linkss h3{
    margin: 0px;
    height: 50px;
    color: #c9c1f5;  
}

.linkss a{
    
    border: 0px;
    display: block;
    padding: 0px;
    margin: 0px;
    font-size: 23px;
    padding-left: 30px;
    color: #c9c1f5;
    height: 30px;
    width: 110px;
}

CodePudding user response:

The HTML should be "class" instead of "className"

<div >

I tested your CSS after updating the HTML and the menu stayed fixed for me.

CodePudding user response:

I think you can try position sticky.

.linkss {
    position: sticky;
    top: 0;
} 
  • Related