I know you can change the cursor of a web page with an image, but is it possible to 'style' the cursor only using CSS?
Something like...
div.changecursor:cursor {
width: 10px;
height: 10px;
background: blue;
border-radius: 199px; /* make it a circle */
}
The cursor property allows the use of an url linking an image to be used as cursor.
In that way you may customize as much as you want
property and value
.classX {
cursor: url(myCursor.cur);
}
Ok with a gif, etc
Related
I have code below :
<div className={cx('overflow-x-scroll')}>
<TabNavigation data={tabs}/>
</div>
I need a custom size thumb scrollbar, from big to small. I am using the tailwind-scrollbar package but my machine is not supported because my project is using node v12.22.9. I have also been browsing but still can't find the answer.
Tailwind-scroll bar does not provide a solution to change the size of the scrollbar.
You can use CSS to do that:
/* Select the scrollbar track */
::-webkit-scrollbar-track {
/* Change the background color */
background-color: #f1f1f1;
}
/* Select the scrollbar thumb */
::-webkit-scrollbar-thumb {
/* Change the background color */
background-color: #888;
/* Change the size of the thumb */
height: 30px;
width: 30px;
}
I'm building an add-on and thus far have done all styling in the add-on's css file (as opposed to a separate skin package). I now need to override the image files used for things like scrollbar handles and menu arrows.
Mozilla has a tutorial for overriding these using themes that are store in the omni.jar file, but we would prefer to avoid creating a separate theme to install when we're already installing an extension.
According to DOM Inspector a scrollbar gets it's style from chrome://global/skin/scrollbars.css and the rules are:
scrollbar {
-moz-appearance: scrollbartrack-horizontal;
-moz-binding: url("chrome://global/content/bindings/scrollbar.xml#scrollbar");
cursor: default;
background: url("chrome://global/skin/scrollbar/slider.gif") scrollbar;
pointer-events: auto;
}
scrollbar[root="true"] {
position: relative;
z-index: 2147483647; /* largest positive value of a signed 32-bit integer */
}
scrollbar[orient="vertical"]
{
-moz-appearance: scrollbartrack-vertical;
}
I've tried poking at the scroll bars in my add-on with:
scrollbar{
-moz-appearance:none!important;
background-image:none!important;
background:red!important;
background-color: green !important;
height:200px;
border:3px solid green;
}
scrollbar slider{
-moz-appearance:none!important;
background:red!important;
height:200px;
border:3px solid green;
}
scrollbar, thumb {
-moz-appearance: none !important;
background:red!important;
}
scrollbarbutton {
-moz-appearance: none !important;
background-color: transparent !important;
}
But unlike other XUL elements that respond to overrides from the add-on's css file, these scrollbars just don't respond to anything. I'm wondering if part of the problem is that the scrollbars are inside the browser window?
How can skin images be changed or overridden from an add-on?
Chrome recently updated its input element styles. I really like the number input type, but their new style gives us rounded buttons that don't fit neatly into square input boxes.
I've put in many attempts to get these inputs to change, but they won't budge. From the input[type='number'] itself to these buttons:
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
border-radius: none !important; background: black; color: red;
}
input:-webkit-autofill { background: black; color: red; }
It seems they may not be able to change at all. Does anyone have experience with this? I know there's a way to hide the buttons. Ideally I just want to remove their border-radius.
Interestingly, padding seems to work on these buttons. I know they're listening!
There are ways to accomplish that. Here's a pure CSS solution:
http://jsfiddle.net/Volker_E/WwfW9/
As you can see, the magic CSS property/value in your case is -webkit-appearance: none;.
Through that the Spin Buttons lose their default appearance. And you're able to style in (nearly) every way you want to.
/* Spin Buttons modified */
input[type="number"].mod::-webkit-outer-spin-button,
input[type="number"].mod::-webkit-inner-spin-button {
-webkit-appearance: none;
background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAKUlEQVQYlWNgwAT/sYhhKPiPT+F/LJgEsHv37v+EMGkmkuImoh2NoQAANlcun/q4OoYAAAAASUVORK5CYII=) no-repeat center center;
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 1em;
border-left: 1px solid #bbb;
opacity: .5; /* shows Spin Buttons per default (Chrome >= 39) */
}
I've added a Data URI image as background (therefor the small size), but you can add whatever image/CSS property you think is fitting your needs.
Only problem remaining is, that you're losing a bit on usability side, as you're not able to style the up and down button separately, and you don't have :hover and :focus styles on a single button.
That's simply not possible with current implementation in Chrome.
Have fun!
Edit 2015-01-18: Improved answer reflecting changes in Chrome >= v39. Thanks to #dtracers
I have a on my page and I have styled it with css.
input[type=range] {
-webkit-appearance: none;
background-color: #1b2b66;
width: 300px;
height: 3px;
position: relative;
top: -9px;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
background-image: url("../images/slider.png");
background-size: 100% auto;
border: 0px;
width: 35px;
height: 35px;
}
The issues is: on the ipad when the user clicks the slider thumb a black border surrounds the image. How do I hide this?
You need to use modernizr to perform a feature detect.
<script src="modernizr.js"></script>
<script>Modernizr.load({
test: Modernizr.inputtypes.range,
nope: ['use your css to define the range input format']
});
</script>
This test looks for support. When it fails, it loads your css to format that input. If a browser has support for this tag, which means there will be a standard way it renders that control and your css will be redundant. In this case, we usually just let the browser ignore our css settings.
If you really want to override the default css settings. Try using !important.
border: 0 !important;
I figured out my issue. First of all thank you everyone for the help.
I forgot to set the background-color: property. I set it to #FFF and now have the desired effect.
I found this code from here: http://www.cssportal.com/form-elements/text-box.htm
But the problem is you can still see the rectangular shape of the textbox whenever you click inside it. What would be the fix for this? So that the highlight will go with the image with rounded corners
/* Rounded Corner */
.tb5 {
background: url(images/rounded.gif) no-repeat top left;
height: 22px;
width: 230px;
}
.tb5a {
border: 0;
width:220px;
margin-top:3px;
}
This should only occur in some browsers such as Google Chrome, it is meant to help with usability and accessibility but it can cause issues with some styling. What you want to do is remove the dynamic outlines like this:
input[type="text"] {
outline: none;
}
In addition, you can try highlighting the text box still by including a background image change using a psedo-selector like :focus
input[type="text"]:focus {
background: url(images/rounded-focused.gif) no-repeat top left;
}