Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > CSS: Class error

Reply
Thread Tools

CSS: Class error

 
 
David Dorward
Guest
Posts: n/a
 
      02-26-2006
Luigi Donatello Asero wrote:

>> > I used this one instead http://www.htmlhelp.com/tools/csscheck/


>> "Error: Classes may contain only the characters A-Z, a-z, 0-9, Unicode
>> 161-255, hyphens, or escaped Unicode characters as numeric codes."


> So, I guess that the validator thinks that "#" is a character of the name
> of the class... instead it means that what it follows is the name of the
> "id"


Looks like it might be a bug then.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
 
 
 
Els
Guest
Posts: n/a
 
      02-26-2006
Michael Winter wrote:

> On 26/02/2006 01:11, Els wrote:
>
>> Luigi Donatello Asero wrote:
>>
>>> What is wrong with this?
>>> .subsubsection#sverige

>
> [snip]
>
>> So, what is it, a class? (.susubsection) an id? (#sverige)?
>> Can't make the two into a hybrid.

>
> Certainly can[1].


Yes, I was entirely mistaken.

[snip explanation]

> As for what a 'class error' is, I have no idea. Unless Luigi cares to
> mention where (and with what) this error apparently occurred, there's
> not much I can add.


I saw in another message of his, that he got that from
http://www.htmlhelp.com/tools/csscheck/ which actually does give that
error (erroneously).

> [1] See the simple_selector production in Appendix D.1 Grammar of
> the CSS 2 Specification.
>
> <http://www.w3.org/TR/REC-CSS2/grammar.html#x1>


Thanks - that's one of the W3C pages I didn't come across before

--
Els http://locusmeus.com/
 
Reply With Quote
 
 
 
 
Els
Guest
Posts: n/a
 
      02-26-2006
Els wrote:

[ .subsubsection#sverige ]
>> [1] See the simple_selector production in Appendix D.1 Grammar of
>> the CSS 2 Specification.
>>
>> <http://www.w3.org/TR/REC-CSS2/grammar.html#x1>


Note: I found this link easier to read:
http://www.w3.org/TR/REC-CSS2/select...imple-selector

--
Els http://locusmeus.com/
 
Reply With Quote
 
Els
Guest
Posts: n/a
 
      02-26-2006
David Dorward wrote:

> Luigi Donatello Asero wrote:
>
>>> > I used this one instead http://www.htmlhelp.com/tools/csscheck/

>
>>> "Error: Classes may contain only the characters A-Z, a-z, 0-9, Unicode
>>> 161-255, hyphens, or escaped Unicode characters as numeric codes."

>
>> So, I guess that the validator thinks that "#" is a character of the name
>> of the class... instead it means that what it follows is the name of the
>> "id"

>
> Looks like it might be a bug then.


Or maybe it's because it's a CSS1 checker:
<quote>
Note: CSSCheck is primarily a CSS1 checker. Many CSS2 properties are
supported, but new CSS2 selectors will generate errors.
</quote>

(If I understood appendix B of the CSS1 specs correctly (of which I'm
not sure), only 1 class/id/pseudo-class is allowed per selector in
CSS1)

--
Els http://locusmeus.com/
 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      02-26-2006
On 26/02/2006 08:53, Els wrote:

> Michael Winter wrote:


[snip]

>> As for what a 'class error' is, I have no idea. [...]

>
> I saw in another message of his, that he got that from
> http://www.htmlhelp.com/tools/csscheck/ which actually does give that
> error (erroneously).


It seems that my news server was sluggish last night; I was missing
about half of the thread when I replied.

[snip]

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      02-26-2006
On 26/02/2006 09:11, Els wrote:

[snip]

> Note: I found this link easier to read:
> http://www.w3.org/TR/REC-CSS2/select...imple-selector


Yes, but I think I ended up paraphrasing the applicable paragraph.
Not intentionally, mind you.

Section 5 (Selectors) doesn't contain any examples of of mixed type
attribute selectors as far as I can see. However, the (normative)
grammar makes it unequivocally clear that they are valid for simple
selectors[1].

Mike


[1] I should point out that the simple_selector production in the
CSS 2 grammar is in error. It was corrected in CSS 2.1 to:

simple_selector
: element_name [ HASH | class | attrib | pseudo ]*
| [ HASH | class | attrib | pseudo ]+
;

The previous production made the selector entirely optional.
That is,

{
/* Declarations */
}

would be valid.

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
 
Reply With Quote
 
Els
Guest
Posts: n/a
 
      02-26-2006
Michael Winter wrote:

> On 26/02/2006 09:11, Els wrote:
>
> [snip]
>
>> Note: I found this link easier to read:
>> http://www.w3.org/TR/REC-CSS2/select...imple-selector

>
> Yes, but I think I ended up paraphrasing the applicable paragraph.
> Not intentionally, mind you.


You did pretty well though - when I first read it, I though you had
literally quoted from the specs. Only you hadn't <g>

[snip, did read it]

--
Els http://locusmeus.com/
 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      02-26-2006
On 26/02/2006 09:21, Els wrote:

[snip]

> (If I understood appendix B of the CSS1 specs correctly (of which I'm
> not sure), only 1 class/id/pseudo-class is allowed per selector in
> CSS1)


I'm not quite sure what you're trying to express, here.

.className or #id

but not

#id.className

An id, class, or pseudo-class selector can appear by itself [optionally
combined with an element], but more than one type of attribute selector
cannot be combined.

Or perhaps:

#id.className

but not

.class1.class2

Multiple attribute selector types can be used together, but only one of
each type can be used at once.

As I read it, the grammar permits the latter, but it also places very
tight constraints on the /order/ of simple selector components: element,
id, class, pseudo-class. A simple selector can contain any of these, but
if any are present, they must appear in that order and can only occur
once at most.

The reason why

.subsubsection#sverige a

fails is because the id selector follows the class name.

#sverige.subsubsection a

will be accepted.

Note that the W3C validator doesn't care much for the order, either
because it wasn't meant to be significant (but that fact couldn't be
expressed concisely in the grammar), or due to a bug.

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
 
Reply With Quote
 
Els
Guest
Posts: n/a
 
      02-26-2006
Michael Winter wrote:

> On 26/02/2006 09:21, Els wrote:
>
> [snip]
>
>> (If I understood appendix B of the CSS1 specs correctly (of which I'm
>> not sure), only 1 class/id/pseudo-class is allowed per selector in
>> CSS1)

>
> I'm not quite sure what you're trying to express, here.
>
> .className or #id
>
> but not
>
> #id.className


That's what I figured appendix B is saying.
Apparently it isn't though:

> As I read it, the grammar permits the latter, but it also places very
> tight constraints on the /order/ of simple selector components: element,
> id, class, pseudo-class. A simple selector can contain any of these, but
> if any are present, they must appear in that order and can only occur
> once at most.
>
> The reason why
>
> .subsubsection#sverige a
>
> fails is because the id selector follows the class name.
>
> #sverige.subsubsection a
>
> will be accepted.


Yes, that CSS1 checker does accept that. I didn't expect that.

> Note that the W3C validator doesn't care much for the order, either
> because it wasn't meant to be significant (but that fact couldn't be
> expressed concisely in the grammar), or due to a bug.


Well, I'll just stick to CSS2.1, which I mostly understand, and
combine that with what works in the browsers. Life can be so easy

--
Els http://locusmeus.com/
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      02-26-2006
Luigi Donatello Asero wrote:

> "David Dorward" <(E-Mail Removed)> skrev i meddelandet
> news:dtr1ro$7su$1$(E-Mail Removed)...
>
>>Luigi Donatello Asero wrote:
>>
>>
>>>What is wrong with this?
>>>.subsubsection#sverige A { background-color: #99ffcc;
>>>background-image:none;
>>>color: #000000; display: block; text-align:center;}
>>>
>>>I get a "class error"

>>
>>From what? The W3C CSS Validator doesn't throw such an error on that code.

>
>
> The W3C CSS Validator did not seem to accept
> URLs with https and for some reason did not display any results when I tried
> to paste the content of the file,
> so I used this one instead
> http://www.htmlhelp.com/tools/csscheck/
> This displayed the error as far as I remember
> Afterwards I tried to make many changes in the stylesheet to improve it and
> it probably needs be much improved yet
>
>



Okay I think I know what is going on here, when Luigi is trying to
specify a A element that is a child of and ELEMENT that is both
CLASS="subssubsection" AND ID="saverige" fails because

..subsubsection#sverige A
^^^^^^^^^^^^^^^^^^^^^^
this is the wrong way to specify the condition as it is being
interpreted as class "subsubsection#sverige" containing an illegal
character '#' thus giving you the "class error", to what you wish Luigi
I think it should be written:

#sverige[class="subsubsection"] a {...}

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Class A contains class B, class B points to class A Joseph Turian C++ 5 12-30-2005 03:24 PM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
A parameterized class (i.e. template class / class template) is not a class? christopher diggins C++ 16 05-04-2005 12:26 AM
Generic class literals - e.g,, Class<Map<String, Integer>>.class Purush Java 4 04-13-2005 08:40 PM
instanciate a class in a jar file with class.forname, while my main class is in another jar cyril Java 2 08-25-2004 06:55 AM



Advertisments