Scrolling Div and :: after element outside

I have a div menu that has a fixed size (e.g. 100% height). Content could be larger. Then it will have to scroll.

div {
    overflow-y: auto;
    width: 10%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
}

      

There is also: after an element on a div that is positioned absolutely right outside the div.

div::after {
    content: "";
    position: absolute;
    left: 10%;
    top: 45%;
    height: 10%;
    width: 5%;
}

      

The problem is that as soon as I add the auto overflow to the div, the after element is hidden. How do I get the scrollbar and have an after element outside of the div? Found a few similar questions, but none of the solutions seem to work for me.

+3


source to share


1 answer


I solved it now by just adding another div inside the original

div.original div.inside {
   overflow-y: auto;
   position: relative;
   width: 100%;
   height: 100;
}

      



and remove the overflow from the original div. You need one more div, but this is probably the simplest and cleanest solution.

+1


source







All Articles