使用自定义滚动条包含文本?

时间:2012-05-01 15:36:34

标签: html css

我编辑了一些很酷的滚动条。我需要文本在中间,所以它就像一个框架......就像你看到你接受某人的服务条款和东西。我试图添加文本,但我似乎无法让它工作? http://jsfiddle.net/Hunter4854/RHMCm/如果您有疑问,请不要投票,只需添加评论,我会回答:)

1 个答案:

答案 0 :(得分:1)

<head>
<meta content="en-us" http-equiv="Content-Language">
<style>body {
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: green;
}

.a::-webkit-scrollbar {
    width: 15px;
    height: 15px;
}

.a::-webkit-scrollbar:vertical {
    background: -webkit-linear-gradient(left, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* Chrome10+,Safari5.1+ */
    background: linear-gradient(left, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* W3C */
}

.a::-webkit-scrollbar:horizontal {
    background: -webkit-linear-gradient(top, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* Chrome10+,Safari5.1+ */
    background: linear-gradient(top, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* W3C */
}

.a::-webkit-scrollbar-track:vertical {
    background: -webkit-linear-gradient(left, #1d1d1d 0%,#1b1b1b 50%,#171717 50%,#1d1d1d 100%); /* Chrome10+,Safari5.1+ */
    background: linear-gradient(left, #1d1d1d 0%,#1b1b1b 50%,#171717 50%,#1d1d1d 100%); /* W3C */
    border-radius: 15px;
}

.a::-webkit-scrollbar-track:horizontal {
    background: -webkit-linear-gradient(top, #1d1d1d 0%,#1b1b1b 50%,#171717 50%,#1d1d1d 100%); /* Chrome10+,Safari5.1+ */
    background: linear-gradient(top, #1d1d1d 0%,#1b1b1b 50%,#171717 50%,#1d1d1d 100%); /* W3C */
    border-radius: 15px;
}

.a::-webkit-scrollbar-thumb {
    border-radius: 15px;
    border: 1px solid black;
}

.a::-webkit-scrollbar-thumb:vertical {
    background: -webkit-linear-gradient(left, #878787 0%,#474747 50%,#282828 50%,#4a4a4a 100%); /* Chrome10+,Safari5.1+ */
    background: linear-gradient(left, #878787 0%,#474747 50%,#282828 50%,#4a4a4a 100%); /* W3C */
}

.a::-webkit-scrollbar-thumb:horizontal {
    background: -webkit-linear-gradient(top, #878787 0%,#474747 50%,#282828 50%,#4a4a4a 100%); /* Chrome10+,Safari5.1+ */
    background: linear-gradient(top, #878787 0%,#474747 50%,#282828 50%,#4a4a4a 100%); /* W3C */
}

.a::-webkit-scrollbar-thumb:hover {
}

.a::-webkit-scrollbar-corner {
    background: black;
}

.a::-webkit-scrollbar-button:vertical {
    background: -webkit-linear-gradient(left, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* Chrome10+,Safari5.1+ */
    background: linear-gradient(left, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* W3C */
}

.a::-webkit-scrollbar-button:horizontal {
    background: -webkit-linear-gradient(top, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* Chrome10+,Safari5.1+ */
    background: linear-gradient(top, #525252 0%,#202020 50%,#020202 50%,#101010 100%); /* W3C */
}
​</style>



</head>



<div class="a" style="position:absolute;width:200px;height:200px;background:white;overflow-y:scroll">
    </div>

在此处查看http://jsfiddle.net/3uTjv/