Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
422 views
in Technique[技术] by (71.8m points)

html - force scrollbar on Safari

Is there a way to force the vertical scrollbar to show on Safari Lion. It only shows if you click the far right of a page. I have an element where I have overflow-y:auto but in Safari it doesn't show until you click the edge of the element.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Ok found this online at this site http://css-tricks.com/custom-scrollbars-in-webkit/ This will make it show up in Safari Lion

::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 8px;
}

::-webkit-scrollbar-track {
    background-color: rgba(57,57,57, .6);
    border-radius: 8px;
}

::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background-color: rgba(156, 156, 156, .6);
}

Obviously you will need to change the properties to suite what you want. Again this is for Safari as overflow-y: scroll; does not force it to show.

If you want to assign this to a scrollbar on a specific element, you can add any css selector before:

.mydiv::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 8px;
}

.mydiv::-webkit-scrollbar-track {
    background-color: rgba(57,57,57, .6);
    border-radius: 8px;
}

.mydiv::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background-color: rgba(156, 156, 156, .6);
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...