How can I prevent scroll bars from being hidden for OS X trackpad users in WebKit/Blink?
Tags: css,webkit,scrollbar,osx-lion,blink
Problem :
WebKit/Blink's (Safari/Chrome) default behaviour on on Mac OS X since 10.7 (Lion) is to hide scroll bars from trackpad users when they're not in use. This can be confusing; the scroll bar is often the only visual cue that an element is scrollable.
Example (jsfiddle)
HTML<div class="frame">
Foo<br />
Bar<br />
Baz<br />
Help I'm trapped in an HTML factory!
</div>
CSS
.frame {
overflow-y: auto;
border: 1px solid black;
height: 3em;
width: 10em;
line-height: 1em;
}
WebKit (Chrome) Screenshot
How can I force a scroll bar to always be displayed on a scrollable element in WebKit?
Solution :
The appearance of the scroll bars can be controlled with WebKit's -webkit-scrollbar
pseudo-elements [blog]. You can disable the default appearance and behaviour by setting -webkit-appearance
[docs] to none
.
Because you're removing the default style, you'll also need to specify the style yourself or the scroll bar will never show up. The following CSS recreates the appearance of the hiding scroll bars:
Example (jsfiddle)
CSS.frame::-webkit-scrollbar {
-webkit-appearance: none;
}
.frame::-webkit-scrollbar:vertical {
width: 11px;
}
.frame::-webkit-scrollbar:horizontal {
height: 11px;
}
.frame::-webkit-scrollbar-thumb {
border-radius: 8px;
border: 2px solid white; /* should match background, can't be transparent */
background-color: rgba(0, 0, 0, .5);
}
.frame::-webkit-scrollbar-track {
background-color: #fff;
border-radius: 8px;
}
WebKit (Chrome) Screenshot
CSS Howto..
I think you should use somethink like #toppart #mainnav ul ul li { float: left; position: relative; } In the Wordpress menus you are going to have all the items...
This line is causing your problems: #menu li a { color: black; display:block; text-decoration:none; } This makes any and all links that are child of a list item display as...
A solution can be as follows: http://jsfiddle.net/cXrBA/2/ HTML <div class="wrapper"> <div class="one"></div> <div class="two"></div> <div class="three"></div> </div> CSS .wrapper { padding-left: 100px; width: 100px; height: 100px; position: relative; } .one...
Set overflow: auto on mainwrapper: #mainwrapper { width:900px overflow: auto; } Its the hasLayout thing when using floats. ...
Try using a mixin. Here's an example from the Mixin section: @mixin border-radius($radius) { -webkit-border-radius: $radius; -moz-border-radius: $radius; -ms-border-radius: $radius; border-radius: $radius; } You can use this like so: h5...
Using any of the preprocessors, like sass, less, or my favorite, stylus, you can easily nest an entire CSS file inside a top level class, effectively namespacing // stylus .top-level-class...
labels are by default inline. They will not respond on top/bottom margin. You have to tell them to display as block/inline-block . Like this label { display: inline-block; margin: 20px...
Nowadays CSS becoming more powerful than JavaScript.With help of Media Query u can specify conditions thus breaking up your Css Structure.Also there are lots of directive tags starting with '@',...
You can use the attribute/value selector as follows; [style*="color:red"] { color: green !important; } [style*="color:green"] { color: red !important; } You need to use the !important keyword to avoid the...
Well, here's one way of doing it. HTML: <ul> <li> <img src="http://www.placekitten.com/16/16"> Item 1 <span>1</span> </li> <!-- More list items --> </ul> CSS: /* Container with border and rounded corners...
You can't do this in pure CSS 2. (Well you sometimes can, depending on your scenario, but only with awful hacks involving absolute positioning and such.) CSS 3 has columns...
Do you mean background-size: cover;? What it does (source): Scale the background image to be as large as possible so that the background area is completely covered by the background...
you can do so by using the :before or :after pseudo. read more about it here http://astronautweb.co/snippet/font-awesome/ change your code to this .lb-prev:hover { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); opacity: 1; text-decoration: none;...
Using :hover on .box did the work for me: .box:hover{ border-color: white } You've to note the order (the following example will not work): .box { border-color: black } .box:hover{...
A contained image would be part of the selector: button:focus, button:focus img { width: 200px; height: 200px; } ...
You can do this with a lot less HTML and only two classes: <a href="http://www.webpage.com/albums" class="album-button">Photo Albums</a> CSS: .album-button { width: 230px; height: 60px; border: 5px solid white; overflow: hidden;...
top and left correspond to the top-left corner of your box. What you're trying to do is have them correspond to the center. So if you set margin-top and margin-left...
Copy the css below: * { margin: 0; padding: 0; } body { font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; } a { text-decoration: none; font-size: 11px; font-weight: 100; width: 100%; box-sizing: border-box; }...
if it has an ID, you don't need any combined selectors, just use #tag-6 as a selector #tag-6 { display: none; } Addition after edit of question: Just make sure...
As far as I understood you, you could just reference the image directly with this selector in your css: .logo img If that's not what you want please add more...
You can use window.getComputedStyle(). The returned value is a CSSStyleDeclaration, and you can access the properties directly using the dot notation or use .getPropertyValue('property name'). var p = document.querySelector('.demo'); var...
You need to add width in both span and use max-width intend of width of image eventPic class named. .section_header { background-color: gray; width:100%; height:5em; display: table; } .section_header span...
You need a url handler in your app.yaml: - url: /Static static_dir: Static/ secure: optional I am not sure about your directory tree. If Static is nested inside Folder, then...
I figured it out. The main problem is that the ASP.NET control renders the DropDown options as an element while Bootstrap expects an element for its DropDown list. I rendered...
How to override CSS style for a specific element if its parent has a specific class
Mou again! You only got the Syntax of the padding wrong: https://jsfiddle.net/pta7Ln59/2/ .webgrid-footer td { padding: 0; } The commas are not OK: padding: 0px,0px,0px; (padding: 0px 0px 0px; would...
Remove left:-50px; from you button body{ background: #000; } .nl-main{ width: 300px; border: 1px solid white; border-radius: 6px; padding: 10px; } .header{ padding: 3px; } .header span{ color: white; }...
Considering navbar height is a constant I came to such solution - http://jsfiddle.net/EPFq7/1/ At first we should set html and body heights to 100%: html,body{ height:100%; } Then we remove...
You can't. Sprites only work when you can limit the size of the element to the size of the section of the image you want to display. Use separate images....
Simplifyyyy Mannn! Floats, an ordered list and a sprinkling of pseudo-elements Compatibility: Safari 3.2+ / IE9+ using nth-child and pseudo elements or Safari 3.1+ / IE8+ with classes and pseudo...
Provided that your CSS file is loaded via <h:outputStylesheet>, use #{resource} mapping. body { padding: 35px; background: #4c4c4c url(#{resource['images/grad1.png']}) 0 0 repeat-x; color: #fff; font: 11px/normal Arial, Helvetica; } ...
Mou again! You only got the Syntax of the padding wrong: https://jsfiddle.net/pta7Ln59/2/ .webgrid-footer td { padding: 0; } The commas are not OK: padding: 0px,0px,0px; (padding: 0px 0px 0px; would...
Remove left:-50px; from you button body{ background: #000; } .nl-main{ width: 300px; border: 1px solid white; border-radius: 6px; padding: 10px; } .header{ padding: 3px; } .header span{ color: white; }...
Considering navbar height is a constant I came to such solution - http://jsfiddle.net/EPFq7/1/ At first we should set html and body heights to 100%: html,body{ height:100%; } Then we remove...
You can't. Sprites only work when you can limit the size of the element to the size of the section of the image you want to display. Use separate images....
Simplifyyyy Mannn! Floats, an ordered list and a sprinkling of pseudo-elements Compatibility: Safari 3.2+ / IE9+ using nth-child and pseudo elements or Safari 3.1+ / IE8+ with classes and pseudo...
Provided that your CSS file is loaded via <h:outputStylesheet>, use #{resource} mapping. body { padding: 35px; background: #4c4c4c url(#{resource['images/grad1.png']}) 0 0 repeat-x; color: #fff; font: 11px/normal Arial, Helvetica; } ...