css custom cursor problems - html

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;
}

Related

Backround of my website is not changing color

So I am really new at programming (literally started yesterday lmao). So I wrote the code and everything and the backround color just doesn't want to change to black. I also have an issue where my image is not showing up on my webiste (it used to but now its only an blank square).
Thanks for answers :)
Please check your CSS file, in CSS file yoou write background:red; so please change that with below code.
<style>
body
{
background-color:red;
}
</style>
For background, you need to write complete term background-color: red; to make it work.
For image, make sure that the image exists in the same directory as the HTML file as you are not giving any extra path in your code.
Also, I would suggest that you go through any beginner guide on youtube first so that most of your queries are answered.
For colouring background, you need to change this:
body { background-color: red; }
And for your image issue, make sure you are entering the right path of the image.
You can also refer here: https://www.w3schools.com/tags/tag_img.asp

Background-Image isn't working on stylesheet but works fine inline

The image doesn't come up on the stylesheet, I've tried so many different things (changing to background
.vegeta {
height: 300px;
width: 300px;
padding: 10px;
background: url("images/vegeta.jpg");
}
However when I put it in the tags on the html page the image shows. The stylesheet is definitely being called by the html document because the other changes show on the page, its just the image that isn't showing up.
Any help would be appreciated, thank you.
First of all you should check all the directory location and spelling, these are the basic problems which we don't notice many time.
Use can use background-image instead of just background because CSS is updated, maybe this can help.
I hope this may help you! Otherwise you can tell me again with all the directory properly.

Html pages and one css page

I am currently making a website for my college project and I want to make it as good as possible. I basically want to have several HTML pages for my website which I have setup but I want to use only the one CSS page. So basically if I edit one page, for example my second page, how do I change the look of it without editing any of the CSS for my first page. I have tried several things but I honestly have no idea.
Any help is appreciated and thank you in advance.
You cannot just change the layout of each page in CSS, CSS is not aware of what the page you are at.
Either do you change the layout by changing the whole CSS file. Or you try to put the CSS special functions for that page inside the page elements.
Otherwise you can't do that!
For example:
You can create a single CSS file and link it as:
<link rel="stylesheet" href="site.css" type="text/css">
Then in each page, where you want the style to be different you can change the style inline:
<element style="property: value; property_2: value_2;"></element>
Like this!
How about adding a class to the body tag on the second page, then specifying the style that are just for that page by using the class.
Page one:
<body>
<p>This page is boring</p>
</body>
Page two:
<body class="page-two">
<p>That's a mighty fine body</p>
</body>
Then your CSS could be
p {
background: white;
}
.page-two p {
background: red;
}
If you have a lot of extra CSS to apply to the second page, then you might consider using LESS or something similar to make your life easier.
Your best method is to have an app.css file that has global settings like height, width... and then have specific page files index.css, portfolio.css.. that have specific styles like colors.
You can specify your button general style in your app.css, and then more specific styles in each page css file.
app.css:
button{
height: 30px;
width: 150px;
border: 1px solid purple;
color: purple;
}
index.css:
button{
border: 1px solid black;
color: black;
}
Add the app.css to each html file, and then only the specific page css file to each html file. This will make it easy to expand in the future.
You need to create a template for your HTML pages and then link an external style sheet in your <head> section of each page like this:
<link rel="stylesheet" href="mystyle.css" type="text/css">
Then for any special cases that are not part of the template, you can link additional style sheets. Just a side note, embedding styles in elements directly is harder to maintain than linking multiple CSS files.
If you are allowed to use JavaScript, you might like to use a JavaScript template engine like Handlebar.js.
The beauty of template engines is that you can define sections and create dynamic HTML. This may be more complex than what you're wanting here, but it is very cool.
A large list of template engines can be found here: http://garann.github.io/template-chooser/

CSS working only on one page but not on the other

I'm making a website for myself (for my jewelry business :) ), for the first time. I can't figure out why css is applyed on one page but not on the other, code for getting css is in both html files the same <link rel="stylesheet" href="shizoid.css"> and they are sharing the same css file.
http://imgur.com/UP3Liae
http://imgur.com/aaGZEa1
You can see on the photos above, for example, in html is tag:
<h1>Extravagant, Unique, Handmade Jewelry and Crafts</h1>
and in css the moderation for it is:
h1 {
background-color: #a018ba;
border-radius: 15px;
font-family: Garamond;
font-size: 40px;
text-align: center;
margin-bottom: 0px;
}
On one page this is working, and on the other isn't. It is like thas from yesterday, it was ok before. I tried to view it both in Firefox and Chrome and on two different computers. I'm looking but I can't see, please help. :)
I have found that it is generally better to apply styles such as borders and backgrounds to a div and then put the h1 into it. For example, your CSS would look something like:
#title-box { width: 800px; margin: 0 auto; background-color: #a018ba; border-radius: 15px; text-align: center; }
h1 { font-family: Garamond; font-size: 40px; }
And your HTML would look like:
<div id="title-box"><h1>Extravagant, Unique, Handmade Jewelry and Crafts</h1></div>
From the photos you posted, I would think that perhaps there is some error elsewhere in your code, such as a without a corresponding that is causing the CSS to not be applied.
Without further information on your website it is hard to determine the actual problem, my first guess is that your second webpage is located in a folder and you haven't updated your CSS.
<link rel="stylesheet" href="../shizoid.css">
If your webpage is on a different folder you can use this href to access the previous directory.
Something is wrong in your idea .It is not css related problem.
Your images are difference. You can see just drag each image and move each image in the browser.You can see that each image has difference.Your whole site is just an image. There is no such kind of tags like you mention <h1>Extravagant, Unique, Handmade Jewelry and Crafts</h1> in your whole html code .Just I posted an image check it either save it in your local drive or drag and drop each image in the new tab browser.
Hope the answer.
I would place the CSS (if it is site wide), in a folder called CSS in your root folder. Then you can simply call the script like this:
<link rel="stylesheet" href="/css/shizoid.css">
From any page...
The initial '/' takes you back to the root of your site.

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