I have used a scrollbar in a div and it works fine. However, if the length of the text within this div exceeds the screen height, it also puts a scrollbar outside this div (i.e. for the entire website) because it thinks that the text continues outside the screen, despite the fact that the text is comprised in a div. How can I make sure that the scrollbar only appears in the small frame (div) and not for the entire website?

Add

overflow:auto;

in the css for your div.

Also, make sure your html validates as there may be something else happening as well.
It's also good to post your html AND css (and a link to the site in question) so people can see what's actually going on.

Without those things, we can only guess.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.