html box上移,HTML Scroll Box

HTML Scroll Box

An HTML scroll box is a box that grows scroll bars when it's contents are too large to fit in the box. How do you make the box? You create the box using a normal HTML element (such as the div element). Then, to make the box scroll, you apply the CSS overflow property to the div.

But, you don't need to worry about the technical details if you don't want to. You can simply copy and paste the HTML scroll box code below. Of course, you can change the values to suit (such as the size of the scroll box, color etc)

Basic HTML Scroll Box

Run

Stack editor

Unstack editor

As you can see, once there's enough text in this box, the box will grow scroll bars... that's why we call it a scroll box! You could also place an image into the scroll box.

Colored Scroll Boxes

Here's an example of an HTML scroll box with color added. You have a number of options when it comes to adding color to your scroll box. Click on the link to add color to your scroll boxes!

Run

Stack editor

Unstack editor

This HTML scroll box has had color added. You can add color to the background of your scroll box. You can also add color to the scroll bars.

Customized Scrollbars

Use WebKit's extensions to customize your scrollbars. Also works on the browser's scrollbars (click Preview).

Run

Stack editor

Unstack editor

My Example

/* Force scrollbars onto browser window */

body {

margin-bottom: 200%;

}

/* Box styles */

.myBox {

border: none;

padding: 5px;

font: 24px/36px sans-serif;

width: 200px;

height: 200px;

overflow: scroll;

}

/* Scrollbar styles */

::-webkit-scrollbar {

width: 12px;

height: 12px;

}

::-webkit-scrollbar-track {

border: 1px solid yellowgreen;

border-radius: 10px;

}

::-webkit-scrollbar-thumb {

background: yellowgreen;

border-radius: 10px;

}

::-webkit-scrollbar-thumb:hover {

background: #88ba1c;

}

Efficient honorificabilitudinitatibus cross-media information without floccinaucinihilipilification cross-media value. Quickly maximize timely deliverables for real-time schemas plenipotentiary.

Scroll Box with Images

You can also add images to your scroll box. This can be either a background image, or, one or more foreground images. Click on the link to add images to your scroll box!

Run

Stack editor

Unstack editor

Sample picture for scroll box

Scroll Box Borders

Here's an example of an HTML scroll box with a border added. Click on the link to add a border to your scroll box!

Run

Stack editor

Unstack editor

This scroll box has had a border added to it. You can add borders to anything in HTML - including scroll boxes.

Horizontal Scroll

Here's an example of an HTML scroll box with a horizontal scroll only. Click on the link to add horizontal scrolling to your scroll box!

Run

Stack editor

Unstack editor

By using overflow-x, we can create scroll bars when the contents of this div are wider than the container. By setting this paragraph to 200 percent, it is 200 percent wider than the parent container - forcing an overflow.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值