Home / the Internet / Web programming / How to add a scroll bar

How to add a scrollbar


How to add a scrollbar</a>

Scroll bars are verticalAnd a horizontal strip placed along the right (when writing from the left to the right) and the bottom edges of the window or a separate area inside the window, designed to move the contents in a vertical or horizontal direction.

To control their appearance and behavior in web pages, the elements of the CSS style description language (Cascading Style Sheets), built into the HTML language, are used.



Use the div tag if you want to make a stripScrolling is not for the entire page, but only for its limited area. In HTML (HyperText Markup Language), "tags" refers to individual commands to the browser to display a particular page element. In the simplest form, the div (often called the "layer") tag is written like this:
& Lt-div & gt-This is the text inside the layer & lt- / div & gt-
Here & lt-div & gt- is the opening tag, and& Lt- / div & gt- - closing. Everything that is placed between the opening and closing tags is in the layer as in the container and this container can be set to the width and height. This is done using an additional parameter ("attribute") style, which should be added to the opening tag:
& Lt-div style = "width: 300px- height: 300px -" & gt-

This is the text inside the layer

& Lt- / div & gt-


Specify in the style attribute of the div tag and the rules for the scroll bars of the layer too:
& Lt-div style = "width: 400px- height: 200px- overflow: auto -" & gt-

This is the text inside the layer

& Lt- / div & gt-
Here is the overflow:Auto means that the scroll bars will appear automatically, that is, when the contents of the layer will not fit into the specified sizes. If auto is replaced with a scroll, then these bands will always be present, regardless of whether they are needed or not. And the value hidden will have the opposite effect - scrolling will never appear, even if the content of this container is not visible behind its edges.


Use the same method for addingScroll bars to the page as a whole. By default, they appear as needed, but if for some reason they need to be permanently present on the page, you must add the appropriate style rule to the source html code. Find in the page code the closing tag of the header part of the document & lt- / head & gt- and write these style instructions before it:
& Lt-style type = "text / css" & gt-body {overflow: scroll -} & lt- / style & gt-

How to add a scrollbar Was last modified: June 20th, 2017 By Lorvouzf
It is main inner container footer text