Scrollbar in DIV container
Question by Axuter | 2012-05-15 at 15:22
I want to make a scrollable area on my website with CSS or HTML.
I am using a DIV container, which should be 200x200 pixels in size and within this container, a content should be displayed, which can be larger than this area.
However, the DIV box should not be enlarged, if the content is bigger. Instead, scrollbars should appear at the edges of the DIV container, so that you can scroll the content. Is that possible somehow?
Related Topics
jQuery: Show or hide DIV-Container depending on Checkbox State
Tutorial | 0 Comments
jQuery: Show a DIV - Hide other DIVs
Tutorial | 0 Comments
JavaScript: Show and hide HTML area by clicking a link
Tutorial | 0 Comments
jQuery: Make Full DIV Container Clickable
Question | 3 Answers
jQuery: Load and Replace DIV Content with clicking Links
Tutorial | 0 Comments
Delphi/Lazarus: Show only one Scrollbar in Scrollbox
Question | 1 Answer
jQuery: Read and Change Data Attribute Value
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
The CSS property, that you seek, is called "overflow". The overflow property requires a region, which height and width is defined. So in your case:
With overflow:scroll, both scrollbars will be always displayed. Instead, if you use overlow:auto, the browser decides individually, if scrollbars are needed or not. So you can, for example, achieve, that in a long text, only vertical scroll bars are displayed. Other features include overflow:hidden, with which the content is simply truncated, if it is too large, and overflow:visible, whereby the contents of the field are protruding whenever they are too big.
But for you, only the properties scroll or auto should be relevant, depending on whether the scrollbars should be displayed always or only when needed.
2012-05-15 at 20:16