A scrollable area is where content can be presented and can be scrolled through. When you have a lot of content to be presented in a particular section, it is beneficial to add a scrollable area, without occupying much space on the page and keeping it organized. You can always add a textarea or use iframe tags to do the same. But through HTML and CSS you can do the same for any page element.
This is done by using the CSS property – overflow. The overflow property takes any of the following values as its input:
- overflow: auto – This will create a horizontal and/or vertical scrollbars only when needed, i.e. when the text exceeds the display area of the element.
- overflow: scroll – This will create horizontal and vertical scrollbars, even if the text inside the element fits into its display area. The scrollbars will always reside.
- overflow: visible – This will cause the element area to expand to make space for the content.
- overflow: hidden – This will force the block to only show the text that fits the in it. Rest of the content will be hidden and would not be visible.
Let us create a scrollable area into a <div>as shown in the image below:
Follow these steps:
- In the Design View, drag the <div> from the Toolbox and drop onto the page. Else in the Code View, manually type the <div></div> tags.
- Then enter your content into the div.
- In the Apply/Manage Styles task pane, click New Style… to launch the New Style dialog box.
- In the New Style dialog box, name the selector as ‘scroll’ and choose following properties:
font-family: “Courier New”, Courier, monospace;
border: 1px solid #4A4A4A;
See image below for more details.
Filed Under: Expression Web
About the Author: Minal is a freelance web and graphics designer. She specializes in designing Logos, Stationery, Graphics and Icons as well as website templates using graphical tools like Photoshop, Illustrator and Expression Web. Twitter @saffronstroke