How to set a custom cursor in html? - html

I want to use a custom cursor icon for my web site (permanently).
How can I do it?
The cursor is downloaded as a simple .ico file.
I have tried the custom cursor command but it did not seem to work.

html, body {
cursor: url("cursor.ico"), default;
/* just change the cursor.ico path to your location */
}
https://davidwalsh.name/css-custom-cursor

You can do this with css.
html {
cursor: url('path/to/your.ico'), default;
}
For more information, check the MDN

best to use .cur file which is best fitted you can get it from real world cursor drawer and draw your own to embed it like this:
cursor: url('hand.cur'),default;

Related

Blazor HTML Link is hidden until mouseover

In Blazor razor page if I place an HTML anchor such as
My Text
the text doesn't show until the mouse is moved over it.
I have worked around this by making it a Button.
Is there any solution to this or or better linkage component to use?
I cannot reproduce this in a new project.
The behaviour seems to suggest this might be a CSS problem. To confirm this, try giving your a an id and set a specific style
#tester {
visibility: visible;
display: inline-block;
color: white;
background-color: red;
font-size: 1rem;
}
Then
<a id="tester" href="http://example.com">My Text</a>
When you run the app you should now hopefully see the link. Right-click it, and select "Inspect Element", then look down the CSS rules for that element for anything that has a strike-through font (meaning it has been overridden by a more specific rule).
One of these should be something hiding your element. Once you've found the culprit, kill it :)

css custom cursor problems

I just started coding, don't judge me if I say stupid things. I'm trying to make a costume cursor for my website but it doesn't work in any way. I've even set the image size, which is 32x32 pixels. This is the picture I tried to use
I doesn't work and not just with this image: I even tried with other ones, png and svg.
I used both "pointer" and "auto" but nothing.
Not working on Safari and not working on Chrome.
Can someone help me please?
Thank you so much!
My code is
body{background-color: #F3F1EB; cursor: url("plane.png"), pointer;}
Your CSS is fine therefore I can only imagine it is one of the following problems:
The plane.png image is not in the same folder as your .html file
The plane.png image is larger than 32x32 pixels
You have not enclosed your CSS in <style></style> tags
You don't have any content within your <body> tag therefore the CSS isn't trigggering
This is tested and works:
<html>
<style>
html {
background-color: #F3F1EB;
cursor: url('plane.png'), pointer;
}
</style>
<body>
//Your page contents here
</body>
</html>
Note: I used the HTML selector for test purposes.
Final point - changing the cursor to a custom image is bad practice for a number of reasons. Mainly, it negatively affects the UX of a site.
Please check if the picture is located in the right folder. I use the full path of the picture you gave, it is working.
body{
background-color: #F3F1EB;
cursor: url("https://i.stack.imgur.com/KDrS2.png"), pointer;
}
<h1>test</h1>
Solution Here !!! Do it at the CSS level:
* {
cursor: url("https://i.stack.imgur.com/KDrS2.png"), pointer;
}

Cannot successfully create custom cursor from image

Here is the hierarchy of my website.
I am trying to set paw.png as my custom cursor.
Here is my code for the custom cursor in main.css.
#body{
cursor: url('Images/paw.png'), auto;
}
I am not sure why it's not working and only the default cursor appears. It would be great if someone could help me fix this issue.
Thanks in advance!
If you intend to apply that cursor to your complete page, you should use the selector body, not #body (which is an id selector)
body{
cursor: url('Images/paw.png'), auto;
}
make sure the URL is right and that you're selecting the right element, also there are some limitations on the size of the image that you can use as a custom cursor.
In Firefox, for example, the limit is 128×128px (Firefox 3.6-3.6.6 on Windows limits this to 32x32px.) so, try to use a 32x32px image to be in the safe zone
for more information: MDN
Well assuming that you have an id="body" on the body tag, you also need to fix the url which should be relative to the .css file and not to the root.
#body{
cursor: url('../Images/paw.png'), auto;
}

How to set own image for a cursor

If I set the cursor for a Label in a css-file as shown below it works as expected. The cursor is a "wait-cursor" if it is moved over the Label
Label.mylabel:hover {
cursor: wait;
}
As it is described in the RWT-Theming-Reference the following should also be possible
Label.mylabel:hover {
cursor: url( resources/cursor.gif );
}
But I can not see my cursor.
How can I set an own image for a cursor?
Turns out that there is a bug in RAP that prevents custom cursors from being rendered. I'll provided a fix that will likely be included in the 3.0.1 release.
Update: the fix is merged and will be available in 3.1 M1 and 3.0.1.
Try this
label.mylabel:hover {
cursor:url("resources/cursor.gif"), auto;
}
Make sure that your are providing correct url for image.

CSS cursor customization

I'm trying to make a CSS code that changes the cursor to a picture file when the cursor is on a webpage. I've seen sites that give you a simple code to do it but they always have ads. Any codes you guys know that can do this?
Yes, simply apply the following css code to your body tag (assuming you want effect for whole page):
body {
cursor: url('URL to image');
}
Further information:
The image file must be 32x32 or smaller
Internet explorer only supports .cur files
CSS:
html{
cursor: url(URL of pictures)
}
Other Simples:
http://www.html1.freeiz.com/Your_cursor.htmlhttp://jsfiddle.net/wNKcU/5/http://jsfiddle.net/wNKcU/788/
create an HTML element with the cursor image you want and use javascript's onmousemove event to move the cursor.
window.onmousemove= function(e) {cursor.left=e.x;cursor.top=e.y;} //cursor is the HTML element