I have to solve a challenge and it requires me to write all the html, css and JS all in one JS file. I'm having trouble figuring out how can I set a pseudo element to a 'div' using JS.
The code for setting my div is:
let myDiv = document.createElement('div')
myDiv.className = 'cart-container'
myDiv.style.cssText = "height: 440px; width: 400px; margin: auto; overflow-y:auto;"
in CSS the pseudo elements would look like this:
.cart-container::-webkit-scrollbar{
width: 10px;
}
.cart-container::-webkit-scrollbar-thumb{
border-radius: 5px;
background-color: #30808d;
height: 100px;
}
how could I inset that CSS code to my 'div' using JS instead of using CSS?