Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Scrollbar in one div only

Scrollbar in one div only


Say, for example, I have two divs like so:


The first div has the attributes position:fixed; and width:100%; in CSS, the other div is just a div with much content inside.

Ok, there is a Scrollbar in the right side, as usual. But this scrollbar affects all of the divs. I want the scrollbar to only affect the second div, is possible?

I tried everything with overflow:auto, overflow:hidden, and overflow:scroll but I didn't reach my goal...

EDIT: Here my jsfiddle:

Problem courtesy of: Antonio Pitasi


Ok, I solved my problem, I used this code:

overflow: hidden;
overflow: scroll;
height: 1500px;

I specified the height in content of #main and it just worked, thanks to everybody!

Solution courtesy of: Antonio Pitasi


View additional discussion.

This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Scrollbar in one div only


Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription