My position: sticky doens't work

I’m trying to make that the “sideSearch” appear meanwhile i scroll to down throught the page. I try diferrents stuffs but i don’t know what i doing wrong. Remenber is React.jsx page.

import React from 'react'
import Card from '../Card'
import database from '../database'
import './Products.css'

 function Products(){

   const cards = => {
    return (
        <Card key={}

        <div className='backgroundProducts' style={{backgroundColor: "  #732C7B"}}>
        <div className="cardSection">
        <div className="sideSearch">
        <form >
        <input type="search" className="search" placeholder='search' />
        <p>filter by type card</p>
        <ul className='filter'>
        <input type="range" className="price-filter" min={0}  max={40}  />
        <p className="priceValue">Value: $</p>
         <div className="content">
export default Products


@import url('');

 color: #BDAEC6;
 font-family: 'Roboto', sans-serif;
 letter-spacing: 0;
text-transform: capitalize;

    display: flex;
    flex-wrap: wrap;

    display: grid;
    place-items: center;
    grid-template-columns: repeat(3, auto) ;
display: flex;
flex-direction: column;
width: 185px;
text-align: center;
margin: 10px

    font-weight: bold;

    display: flex;
    justify-content: center;
    text-align: center;
    background-color: rgb(255, 255, 255, 0.1);
    padding: 20px;
    margin: 10px;
    height: 100%;
    position: sticky;
    top: 0;
    z-index: 1;
   position: -webkit-sticky;
   position: sticky;
   top: 0;
   margin-top: -10px

.filter > li{
    cursor: pointer;
    transition: all 0.3s linear;

.filter > li:hover{
   color: #421C52
    padding: 8px 6px;
    border: none;
    border-radius: 6px;
   background-color: #421C52;
    font-family: 'Roboto', sans-serif;
    margin-bottom: 10px;
    color: #BDAEC6;


    border: 1px solid black;


If you move the sticky elements out of the containers they are inside it should work (the offset is relative to its nearest scrolling ancestor/containing block).

It should also work as is if you use position fixed but that will require some more CSS to have the same layout (because the element is now out of flow).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.