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

Scrollbar in one div only

Scrollbar in one div only

Problem

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


    
    
MY OTHER CONTENTS

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: http://jsfiddle.net/upcfp/

Problem courtesy of: Antonio Pitasi

Solution

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

body{
overflow: hidden;
}
#main{
overflow: scroll;
}
#maincontent{
height: 1500px;
}

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

Solution courtesy of: Antonio Pitasi

Discussion

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

×