PDA

View Full Version : "Fancy Cursor Script" omition



gdw
03-05-2005, 08:12 PM
Hello;
I would like to use MY OWN CURSORS with your "Fancy Cursor Script".
Is that possible? Can it be re-written for that?

Thank-You for your time. :(

jscheuer1
03-06-2005, 05:04 AM
gdw,

Using the example code given:

<span style="cursor:\pointer;cursor:hand">This span has a "hand" cursor</span>

(I had to put a \ in the above example or the : and the p would make a weird smiley face)

you can use:

<span style="cursor:url(path/some.cur),hand,pointer">This span has a custom cursor in IE5+ and a "hand" cursor in other browsers</span>

Where path is the absolute or relative path to the cursor file you have created using a program that makes valid cursor files (like microangelo). Only works for IE5+ I believe. I can only guarantee it working in IE6+.

gdw
03-06-2005, 08:33 AM
Thank-You, I greatly appreciate your help.

One last question, if I may...

Is it:
"cursor:url(path/some.cur),hand,pointer" (with a comma)
or...
"cursor:url(path/some.cur);hand,pointer" (with a semi-colon)?

jscheuer1
03-07-2005, 09:03 AM
The way I wrote it, it is a comma. That gives browsers a choice. If they can't do the first thing, they go to the thing after the comma and so on until they find an attribute they support. It is the same as with the font-family style declaration. On the other hand, you can write it with semicolons but not just substituting them for the commas. With semicolons, each declaration must be complete.

with comas:

style="cursor:url('path/some.cur'),hand,pointer,text,default;"

notice I single quoted the path/some.cur this time, generally that is optional but, good form.

with semicolons:

style="cursor:url('path/some.cur');cursor:hand;cursor:\pointer;"

If you try the above, take out the '\'

however, with semicolons, even browsers that support the url declaration may just go with one of the later declarations, so comas are better in this case. Now, I've got a question for you. Why not just try them both and see what happens? By the time you read this, you probably have. Anyways, only higher versions of IE support this url cursor declaration. Good luck with it!

mwinter
03-07-2005, 02:00 PM
cursor:url('path/some.cur'),hand,pointer,text,default;That is invalid CSS. Multiple url values may be provided and separated by commas, but only one standard type is allowed in any single declaration.


notice I single quoted the path/some.cur this time, generally that is optional but, good form.Not particularly. There is no compulsion to quote values, nor are there any situations when quotes are required. They are optional: simple as that.


cursor:url('path/some.cur');cursor:hand;cursor:\pointer;That too, is invalid CSS. The first declaration is invalid as a standard value is always required. The second is invalid as there is no defined hand cursor value. The third is invalid as \p isn't a valid escape code.

I understand why the hand value is present, but that doesn't make it any more correct.

Mike

jscheuer1
03-07-2005, 05:59 PM
Before you go confusing others, particularly the poor fellow originally asking for help here, get your facts straight (see below the quoted section).


That is invalid CSS. Multiple url values may be provided and separated by commas, but only one standard type is allowed in any single declaration.

Not particularly. There is no compulsion to quote values, nor are there any situations when quotes are required. They are optional: simple as that.

That too, is invalid CSS. The first declaration is invalid as a standard value is always required. The second is invalid as there is no defined hand cursor value. The third is invalid as \p isn't a valid escape code.

I understand why the hand value is present, but that doesn't make it any more correct.
Mike

As I understand it, you are simply wrong. If you do not believe me, go to the W3schools:

http://www.w3schools.com/css/pr_class_cursor.asp

,home of the W3C: Web Standards. Where are you getting your information from?
Two reasons I can figure to quote the filename are:

1. To adhere to strict standards if your page uses a doctype declaration that requires same.

2. To prevent some browsers from misunderstanding where the filename (and path if included) begin and end in the declaration.

About the \p. I told the fellow to take out the \. I used it to prevent this:
:p
from appearing in the message at that point. Know a better way?

As for the rest of your comments, go to 'school' :)

mwinter
03-07-2005, 11:49 PM
[...] get your facts straight [...]Indeed I was mistaken:


cursor:\pointer;is valid. I didn't realise the sequence <space> -> ~ (tilde) listed in the escape grammar rule spanned all alphanumeric symbols as well as punctuation (oh no! I haven't memorised ASCII! :rolleyes: ). Other than that, my post was factually accurate.


As I understand it, you are simply wrong.Then either you don't understand, or your information is wrong...


[...] W3schools:...and it could be the latter.


http://www.w3schools.com/css/pr_class_cursor.aspHowever, nothing written in that document contradicts what I stated. In fact, that document doesn't say much of anything.


home of the W3C: Web Standards.The home of the W3C is http://www.w3.org/. W3Schools has absolutely no affiliation with the Consortium. They are just a tutorial site like hundreds of others.


Where are you getting your information from?The W3C's published recommendations. There is not a more authoritative source.


Two reasons I can figure to quote the filename are:

1. To adhere to strict standards if your page uses a doctype declaration that requires same.The DOCTYPE for a document has no bearing on the content of a style sheet. In modern browsers, the DOCTYPE modifies rendering behaviour, nothing more. The DOCTYPE is also required for validation. However, it does not change the fundamentals of style sheet parsing.


2. To prevent some browsers from misunderstanding where the filename (and path if included) begin and end in the declaration.That is what the functional notation, url() does. You seem to be applying HTML outside of its domain.


About the \p. I told the fellow to take out the \. I used it to prevent this:
:p
from appearing in the message at that point. Know a better way?Yes, two. Either disable smilies using the option below the post controls, or place a space between the two characters.


As for the rest of your comments, go to 'school' :)Might I suggest the same to you, though perhaps the phrase "go to spec." is more appropriate.

If you really want me to, I'll walk you through the specification, pointing out where I obtained the facts. Alternatively, you could just accept that I'm right. Sorry to sound arrogant, but you did tell me to "get [my] facts straight". I think I deserve the right to return the remark in kind.

Mike

jscheuer1
03-08-2005, 05:17 AM
Don't want to get into an argument over this, I'll just mention one error in your post:
The same style declaration (for example: assuming pixels without stating them) will work in quirks mode but not with a strict doctype. Best way to code though is not to argue over little things but, to use what works.

Thanks for the tip on the smileys.

P.S. Just checked about the school. I would debate that they are just like any other help site however, you are correct, not affiliated directly with W3.org which I just saw supports my use of the comma in the cursor declaration as well.

mwinter
03-08-2005, 11:43 AM
The same style declaration (for example: assuming pixels without stating them) will work in quirks mode but not with a strict doctype.The difference between quirks and standards mode is the deliberate use of browser bugs (or the bugs themselves in still-broken user agents). It is those bugs which result in different parsing behaviour, not the DOCTYPE.


I would debate that they are just like any other help siteIn what way? They have more material than most, but so what? My point was that they are not an authority on HTML, nor any other Web technology.


I just saw [the W3C] supports my use of the comma in the cursor declaration as well.Mind quoting or linking to where you see this "support"?

From the CSS 2 Recommendation (repeated verbatim in CSS 2.1):


'cursor'

Value: [ [<uri> ,]* [ auto | crosshair | default | pointer | move | e-resize
| ne-resize | nw-resize | n-resize | se-resize | sw-resize
| s-resize | w-resize | text | wait | help ] ] | inheritSquare brackets are grouping operators and pipes/bars (|) separate alternatives. Double bars (||) separate options. Groups and keywords may be followed by quantifiers. An asterisk (*) means zero-or-more, whilst a plus (+) means one-or-more. A question mark (?) designates an optional value (that is, zero-or-one). The last qualifier is a pair of numbers surrounded by braces: {n,m}. n specifies the minimum number of occurances for the value, and m specifies the maximum.

Now that I've provided a quick primer, you should be able to read that URI values are optional, though many can be specified if desired, separated by commas. However, note that the way the syntax is written, the last URI value will be followed by a comma. Also, notice that the list of keywords is not optional. That supports my statement that URI values cannot be used by themselves and must be accompanied by a generic type. Notice that the keywords are alternatives, not options, that only one can be included (no quantifier), and there are no specified separators. Your use of commas is not supported. Finally, there is no hand keyword (though I'm sure we all knew that).

The specifications are normative. Other documents are to be considered informative. Unless a correction or alteration is provided in the errata for a Recommendation[1] (and there isn't in this case), or the Recommendation status is changed, the content of a Recommendation stands.

Mike


[1] The W3C word for "standard".

jscheuer1
03-08-2005, 09:35 PM
This is from:

http://www.w3.org/TR/CSS21/ui.html


:link,:visited { cursor: url(example.svg#linkcursor), url(hyper.cur), pointer }

Don't be such a nit picker. I am through with this thread.

P.S. Since I am through with this thread, I'm adding that this declaration:

div {cursor:url('blank.cur'),pointer,crosshair,default;}

validates on the w3C CSS validator. So would the one with 'hand' in it, if the validator understood, as I know you do, the reason for including 'hand' in the declaration. To be fair to your obvious nit picking nature, 'crosshair' and 'default' were seen as unnecessary, but not invalid. However, something is needed for browsers that do not support either the url or the pointer, unless you want the default and the possibility of an unexpected result that could render your page as garbage. BTW, the quotes around 'blank.cur' were not stripped out by the validator. This would indicate that they might have some purpose. Now, how has any of this helped the fellow with the original question? If he follows my suggestions from before you became involved, he will have fine in line style that works.

mwinter
03-10-2005, 05:25 PM
This is from:

http://www.w3.org/TR/CSS21/ui.html

:link,:visited { cursor: url(example.svg#linkcursor), url(hyper.cur), pointer }That doesn't prove your point, nor does it disprove mine. You posted a declaration containing multiple keywords separated by commas. That's what I'm disputing.


I am through with this thread.Good. It's a waste of both of our time as you're either failing to grasp the points that I'm making (and I don't think I can be much clearer), or you're arguing for the sake of arguing: you've haven't managed to disprove anything I've said, but you continue to make one irrelevant remark after another.


div {cursor:url('blank.cur'),pointer,crosshair,default;}

validates on the w3C CSS validator.As soon as the validator encounters the first valid keyword, it ends its parsing of the value list. That's why it doesn't list the other values as "valid information". The declaration might be valid according to the global grammar, but it is not according to the property definition.

In any case, a validator is a tool. Just like the HTML validator, there is only so much an automated should be responsible for. Moreover, the validators have never been an indication of true validity: a document or style sheet must still comply with the prose of its respective specification.


So would the one with 'hand' in it,Because the validator doesn't parse far enough into the declaration to discover it. If you move the keyword adjacent to the latter URI value, the validation will declare the declaration invalid. You can see that with the declaration I quoted in my first post to this thread.


However, something is needed for browsers that do not support either the url or the pointer,If you need an early IE equivalent to


some-selector {
cursor: url(...), pointer;
}there are numerous approaches. One is


* html some-selector {
cursor: url(...), hand;
}placed after the rule above. No other user agent to my knowledge believes that there are ancestors to the html element (because there aren't). The declaration still isn't valid, but hand will never be. If that doesn't take your fancy, any other IE-specific hack, including conditional comments or Tantek, will do.


an unexpected result that could render your page as garbage.How could a default cursor render a page garbage? For a start, you do realise that CSS rules are just suggestions, don't you? A user agent doesn't have to support them, and users can override them.


BTW, the quotes around 'blank.cur' were not stripped out by the validator.But neither are they inserted if omitted.


This would indicate that they might have some purpose.No, it doesn't.


Now, how has any of this helped the fellow with the original question?The intention was to bring to light the mistakes in your suggestions, not to end up in a pointless debate. If you didn't know how to correct the problem, you should have asked. If you did, you should have posted a modified suggestion.

Hopefully, this will be my last post to this thread as well.

Mike

jscheuer1
03-11-2005, 05:37 AM
I know I said my previous post was my last in this thread but, I'm wanting to put something in here because I think both Mike and I went off at least slightly on something other than the matter at hand, I probably more so than he. Rather than continue debate I want to state that from reading his other posts in these forums, he is obviously extremely knowledgeable and I would be happy to accept his help for any problem I might bring up in these forums, assuming he is so inclined, of course. I still don't get how what Mike and I did helped gdw, the original poster, better than just saying that the code would validate and yes it is not absolutely to standards and yes it works, or simply leaving it stand. Mike and I will probably always have a tendency to diverging views of writing to spec and writing what works. I don't think I could ever be so rigid in my coding, not that that is a bad thing. Anyways, being new here, I now see that I never should of told Mike to go to school, he could run one.