Predo
Predo

Reputation: 23

Styling scrollbar only for div, not for entire body

I'm working on my personal portfolio website and I have a problem with styling scrollbar. When I change it for entire body, it works perfectly, but when I want to style it only for scrollable content section (navbar is sticked to the top), everything crashes and I can't even scroll the content. I also wanted scrollbar-track to be transparent but it didn't work either.

/* Scrollbar */

.content::-webkit-scrollbar
{
    width: 10px;
}

.content::-webkit-scrollbar-thumb
{
    background-color: rgba(83, 83, 83, 0.8);
    border-radius: 5px;
}

.content::-webkit-scrollbar-thumb:hover
{
    background-color: rgba(83, 83, 83, 1);
}

CodePen link

Upvotes: 0

Views: 1109

Answers (1)

Nimitt Shah
Nimitt Shah

Reputation: 4587

You are missing the content height. Just add content height, you will see scrollbar.

.content{
    height:300px; //for example.
}

Upvotes: 1

Related Questions