html body scroll,HTML Scrollbars

HTML Scrollbars

This page contains code for customizing scrollbars. You can use this code on scrollbars of the browser window, as well as scrollbars on HTML elements such as and

elements with the overflow property set to allow scrollbars to appear when its content takes up more space than itself.

Webkit Browsers

The following code should work in WebKit browsers, such as Safari, Chrome, and Opera. Check out CSS scrollbars for an explanation of this code.

Click Preview to see each example's effect on the browser's scrollbars.

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 {

box-shadow: inset 0 0 10px olivedrab;

border-radius: 10px;

}

::-webkit-scrollbar-thumb {

border-radius: 10px;

background: yellowgreen;

box-shadow: inset 0 0 6px rgba(0,0,0,0.5);

}

::-webkit-scrollbar-thumb:hover {

background: #7bac10;

}

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

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 {

background: #f5f5f5;

border-radius: 10px;

}

::-webkit-scrollbar-thumb {

border-radius: 10px;

background: #ccc;

}

::-webkit-scrollbar-thumb:hover {

background: #999;

}

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

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 {

background: gold;

border-radius: 10px;

}

::-webkit-scrollbar-thumb {

border-radius: 10px;

background: yellowgreen;

}

::-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.

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 {

width: 2px;

border: 1px dashed goldenrod;

}

::-webkit-scrollbar-thumb {

background: goldenrod;

}

::-webkit-scrollbar-thumb:hover {

background: darkgoldenrod;

}

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

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.

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-radius: 10px;

width: 2px;

border: 1px dotted pink;

}

::-webkit-scrollbar-thumb {

background: pink;

border-radius: 10px;

}

::-webkit-scrollbar-thumb:hover {

background: hotpink;

}

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

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-radius: 12px;

}

::-webkit-scrollbar-track:vertical {

background: -webkit-linear-gradient(top, white, gold);

}

::-webkit-scrollbar-track:horizontal {

background: -webkit-linear-gradient(left, white, gold);

}

::-webkit-scrollbar-thumb {

background: yellowgreen;

border-radius: 12px;

}

::-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.

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: 50px;

height: 50px;

}

::-webkit-scrollbar-track {

background: gold;

}

::-webkit-scrollbar-thumb {

background: yellowgreen;

}

::-webkit-scrollbar-thumb:hover {

background: limegreen;

}

::-webkit-scrollbar-corner {

border-right: 1px solid gold;

border-bottom: 1px solid gold;

}

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

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: 8px;

height: 8px;

}

::-webkit-scrollbar-track {

background: gold;

}

::-webkit-scrollbar-thumb {

background: yellowgreen;

}

::-webkit-scrollbar-thumb:hover {

background: #88ba1c;

}

::-webkit-scrollbar-corner {

background: gold;

}

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

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: 8px;

height: 8px;

}

::-webkit-scrollbar-track {

border: 1px solid yellowgreen;

}

::-webkit-scrollbar-thumb {

background: yellowgreen;

}

::-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.

Internet Explorer

The following codes will only work on Internet Explorer as they use the proprietary extensions for Internet Explorer.

Scrollbar for Browser Window

Run

Stack editor

Unstack editor

My Example

body {

-ms-scrollbar-base-color: orange;

margin-bottom: 200%;

}

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

Scrollbar Color for Only

You can add color to the scrollbars of your form elements without it affecting the browser scrollbars. All you need to do is replace

with the name of the form element. For example, change to . Like this:

Run

Stack editor

Unstack editor

My Example

textarea {

-ms-scrollbar-base-color: orange;

}

Here's enough text to make this textarea grow scrollbars.... HTML scrollbars, scrollbar color, change browser scrollbars, css scrollbar, change color of the scrollbar...

More Options

If you want more control over the scrollbar color, you can use a bunch of other properties. Here they are - their names are reasonably self explanatory. Try experimenting around with different colors to see the different effect it has on your scrollbars.

Run

Stack editor

Unstack editor

My Example

textarea.custom-scrollbar {

-ms-scrollbar-3dlight-color:black;

-ms-scrollbar-arrow-color:black;

-ms-scrollbar-track-color:black;

-ms-scrollbar-darkshadow-color:gray;

-ms-scrollbar-face-color:orange;

-ms-scrollbar-highlight-color:gold;

-ms-scrollbar-shadow-color:brown;

}

Here's enough text to make this textarea grow scrollbars.... HTML scrollbars, scrollbar color, change browser scrollbars, css scrollbar, change color of the scrollbar...

Browser Compatibility

The codes on this page use non-standard CSS. At the time of writing, the official CSS specification doesn't provide for customizing scrollbars. However, certain browser vendors provide proprietary extensions that allow for this. WebKit has the -webkit- range of extensions, and Microsoft has the -ms- extensions. The examples on this page use these vendor extensions.

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值