I have the following CSS that hides the mouse cursor for anything on the web page. It works perfectly in Firefox, but in IE and Chrome, it doesn't work.
html {
cursor: none;
}
In Chrome, I always see the mouse pointer. In IE, however, I see whatever cursor was last 'active' when it entered the screen. Presumably it's keeping the last selection instead of removing it.
This property cursor:none; isn't part of the standard
See here w3c cursor CSS properties.
You might want to look into hiding it with Javascript or JQuery.
Also, look at blank cursor files here.
And one last link to an ajax solution.
Chrome has had this issue since it was built, there have been reports sent to the people at Chromium, and I assume they are working on it.
Also, don't trust that anything would work in IE. Ever. :P
I had the same problem in these days and found a good solution to hide the pointer in Google Chrome.
This is the W3C definition of url property:
A comma separated of URLs to custom
cursors. Note: Always specify a
generic cursor at the end of the list,
in case none of the URL-defined
cursors can be used
So, you can define a url to not completely transparent image, followed by the default pointer:
cursor: url(img/almost_transparent.png), default;
If you choose a totally transparent png, Chrome will display a black rectangle instead, but if you choose a png with at least 1px not transparent it will work, and nobody will notice the pointer.
Finding something that works across browsers is a pain.
The code below works on Chrome, IE, and Firefox. IE likes .cur files, Chrome likes the embedded png, and some browsers actually respect the none :)
div {
cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjbQg61aAAAADUlEQVQYV2P4//8/IwAI/QL/+TZZdwAAAABJRU5ErkJggg=='),
url(images/blank.cur),
none;
}
So the best way to deal with this now is the pointer lock api.
https://developer.mozilla.org/en-US/docs/WebAPI/Pointer_Lock
It'll hide the mouse cursor, but give you access to the data about mouse movement as well.
In css: * { cursor: url(cursor.png), none !important }
Use a hidden applet with the java.awt.robot class to move the cursor off the sreen. Say the very lower left corner.
Related
I have an input type date on a web form. When a user prints the form, the clear button (the gray circle w/ an "x" in it) prints next to the date. Obviously this isn't ideal. I have played around w/ a few moz kits but I cant make that clear button invisible on print, no matter what I have tried thus far. Also, the form is being used exclusively in Firefox. Any advice on making this work would be greatly appreciated!
I have tried using this in a css document under #media print {}
input[type=date]::-ms-clear {
display: none;
}
I have tried the same thing with:
::-webkit-search-cancel-button
neither has any effect.
It is not possible to remove the clear button in FireFox. The ::ms-clear feature is only for Microsoft browsers, as described in the MDN documentation.
https://developer.mozilla.org/en-US/docs/Web/CSS/%3A%3A-ms-clear
You need to design your own date picker from scratch or use one from a library.
So I have developed a basic website which runs on old feature phones as well as smartphones. Now on a feature phone, at times, a mouse pointer appears via which it makes it easier for the user to scroll and select certain options on the website. I have tried replicating the process but I have been unable to do so. It always happens randomly. I would love to know what I can add to my code to get the mouse pointer permanently active. Keep in mind I cant use Javascript as the feature phone I am testing on does not have JS and this is also the case for most of my users.
You just need to use cursor: pointer in the CSS for whichever element you want to display the cursor for. For the whole document, that would be:
body {
cursor: pointer;
}
Hope this helps!
I want to know if there is the possibility, by browser inspection of write a new class containing new hover/focus. For example
.CanIDo {
/*something css
(ex.)*/
width: 100;
}
/*my question (BY BROWSER ISPECTOR, i don't want to type it directly in my css using a text editor)*/
.CanIdo a:hover{
opacity: 0.7;
}
I think this is impossible because browser ispector don't admit to change a class directly, but only the containing of that class (right?), but maybe there are browser that have impove that, I think it can be helpful developing a web site.
Thanks!
If I understand your question, you are asking if you can write CSS "on the fly" in a browser Dev Tool and see the effects immediately on your page?
The short answer is yes. The Dev Tools in Chrome, FireFox, and even the latest IE/Edge browsers have that ability. You can tweak applied styles one by one using a DOM inspector or even wholesale update a CSS file in a Sources tab (the name varies slightly between browsers).
And yes, you can write pseudo-class rules like hover and they'll take effect. You can develop or tweak your code and see the results immediately.
Most browsers have inspect tools that allow you to add any class on the fly.
For instance on Chrome if you open Developer Tools you can add any class to your css, be that a :hover variant or any other normal class, pseudo-class.
What you have to do is open the inspector Cmd + Shift + I on OSx and you'll see this on the Elements tab:
You can see that on the Filter you have a "+" button, clicking that you'd be able to stuff like this:
Those two classes a:hvoer and other-class are added via the inspector as you can see on the right is written: inspector-stylesheet
I'm attempting to change the mouse cursor programmatically using JS/CSS, and here's my problem: it seems that Chrome will *force the pointer back to the default pointer no matter what one sets it to.
Here's a minimal example that illustrates the problem:
<html>
<head>
<style type="text/css">
div#mouse_test
{
cursor: crosshair;
}
</style>
<body>
<div id="mouse_test">Here is a small div</div>
</body>
</html>
When I view the above example in Firefox, it works as expected, in that mousing over the text of the div changes the cursor to a crosshair.
When I view it in Chrome, though, the cursor changes to a crosshair then (after about a second) changes back to the default pointer.
Does anyone have any insights? Is it true that Chrome forces the default pointer? If so, is there any way to get around that?
Any help would be greatly appreciated. Thanks!
FIXED
Turns out that restarting my browser fixed the issue. Still odd, though, as I was seeing the problem behavior on *every page that changed the mouse cursor- the one I was working on, as well as several pages with CSS cursor examples that I was viewing. I was working with JS timers to set the cursor, so it's possible that one of those was hanging around in the background. Still odd, since the behavior was completely consistent across multiple tabs.
Big thanks to the Stack Overflow community for the quick and helpful responses :)
That doesn't happen for me in Chrome 9.
So I don't believe it forces the pointer.
Restart your browser and try again (sometimes my cursor flickers between the pointer and normal).
I was delighted to discover that Android 2.2 supports the position:fixed CSS selector. I've built a simple proof-of concept, here:
http://kentbrewster.com/android-scroller/scroller.html
... which works like a charm. When I attempt to add an INPUT tag to my header, however, I hit trouble. On focus, every device I've tried so far clones the INPUT tag, gives it an infinite Z-index, and repaints it on top of the old tag. The clone is in roughly the right position, but most of its parent's CSS (including, of course, position:fixed) is ignored. The cloned INPUT tag is the wrong size and shape, and when I scroll the body of the page, it scrolls up and off the screen.
Once it's off screen, hilarity ensues. Sometimes the device will force the scrolling part of the body back down so the cloned blank is back in view; sometimes the keyboard goes away even though the visible box seems to remain in focus; sometimes the keyboard cannot be dismissed even though the INPUT blank is clearly blurred. Here's an example you can run on your Android 2.2 device to see what's happening:
http://kentbrewster.com/android-input-style-bug/
Styling input:focus has not done the trick for me yet, nor have many different brute-force attempts to listen for focus() and blur() with JavaScript and do the right thing with focus and the keyboard.
Thanks very much for your help,
--Kent
This will probably not be resolved until Android switches to using Chrome for its WebView. The current Android browser creates an Android TextView on top of the page when an HTML input field is focussed. Apparently they don't style or position it correctly. You can see it go more wrong on pages that use contentEditable.
The current Chrome-for-Android implements the WebKit IME interface, so input fields are drawn by WebKit (and lose some of the niceties of the Android TextView on ICS) and shouldn't have issues like this.
The solution is to add:
input {
-webkit-user-modify: read-write-plaintext-only;
-webkit-tap-highlight-color: rgba(255,255,255,0);
}
in your css.
You might be able to solve it by using a bug in Android: http://code.google.com/p/android/issues/detail?id=14295.
That is, don't display the input field right away. Instead, display an overlay div which listens on click and hides itself and shows the hidden input, and give the input focus. This somehow prevents Android from using the wierd input that gets placed on top of everything, and is instead using the browsers input field which you can style any way you want.
As you'll note in the bug raport though, this doesn't work with input[type="number"]...