CSS: overflow (scrollbar)
OverFlow Property
overflow property
specifies what to do when an element is larger than its container box.
It can create scrollbar, or simply crop the extra parts.
Example
The Time Traveller (for so it will be convenient to speak of him) was expounding a recondite matter to us. His grey eyes shone and twinkled, and his usually pale face was flushed and animated. The fire burned brightly, and the soft radiance of the incandescent lights in the lilies of silver caught the bubbles that flashed and passed in our glasses. Our chairs, being his patents, embraced and caressed us rather than submitted to be sat upon, and there was that luxurious after-dinner atmosphere when thought runs gracefully free of the trammels of precision. And he put it to us in this way—marking the points with a lean forefinger—as we sat and lazily admired his earnestness over this new paradox (as we thought it) and his fecundity.
Code
<div class="xoverf-Nf9vB"> The Time Traveller (for so it will be convenient to speak of him) was expounding a recondite matter to us. His grey eyes shone and twinkled, and his usually pale face was flushed and animated. The fire burned brightly, and the soft radiance of the incandescent lights in the lilies of silver caught the bubbles that flashed and passed in our glasses. Our chairs, being his patents, embraced and caressed us rather than submitted to be sat upon, and there was that luxurious after-dinner atmosphere when thought runs gracefully free of the trammels of precision. And he put it to us in this way—marking the points with a lean forefinger—as we sat and lazily admired his earnestness over this new paradox (as we thought it) and his fecundity. </div>
.xoverf-Nf9vB { width: 30rch; height: 9rem; overflow: scroll; }
Values
overflow: visible-
default. Content may be rendered outside the container element.
overflow: hidden-
Content are clipped.
overflow: scroll-
show both horizontal and vertical scroll bars when content is larger than the container box.
overflow: auto-
show vertical or horizontal scroll bar as necessary.