Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

CSS: Class error

 
 
Els
Guest
Posts: n/a
 
      02-26-2006
Jonathan N. Little wrote:

> 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 {...}


..subsubsection#sverige is actually correct.
Proof:
<http://validator.w3.org/check?verbose=1&uri=http://here.locusmeus.com/temp/idclass.html>

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

> .subsubsection#sverige is actually correct.
> Proof:
> <http://validator.w3.org/check?verbose=1&uri=http://here.locusmeus.com/temp/idclass.html>


Duh, how about this one:
<http://jigsaw.w3.org/css-validator/validator?profile=css2&warning=2&uri=http://here.locusmeus.com/temp/idclass.html>

--
Els http://locusmeus.com/
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      02-26-2006
Els wrote:
> Els wrote:
>
>
>>.subsubsection#sverige is actually correct.
>>Proof:
>><http://validator.w3.org/check?verbose=1&uri=http://here.locusmeus.com/temp/idclass.html>

>
>
> Duh, how about this one:
> <http://jigsaw.w3.org/css-validator/validator?profile=css2&warning=2&uri=http://here.locusmeus.com/temp/idclass.html>
>

Yep I noticed that too but yes it also validates. Hmmm I do not know
why sir Luigi had an error, most likely a duplicate identifier somewhere.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Els
Guest
Posts: n/a
 
      02-26-2006
Jonathan N. Little wrote:
> Els wrote:
>> Els wrote:
>>
>>>.subsubsection#sverige is actually correct.
>>>Proof:
>>><http://validator.w3.org/check?verbose=1&uri=http://here.locusmeus.com/temp/idclass.html>

>>
>> Duh, how about this one:
>> <http://jigsaw.w3.org/css-validator/validator?profile=css2&warning=2&uri=http://here.locusmeus.com/temp/idclass.html>
>>

> Yep I noticed that too but yes it also validates. Hmmm I do not know
> why sir Luigi had an error, most likely a duplicate identifier somewhere.


No, he used the wrong CSS checker:
http://www.htmlhelp.com/tools/csscheck/


--
Els http://locusmeus.com/
 
Reply With Quote
 
Luigi Donatello Asero
Guest
Posts: n/a
 
      02-27-2006

"Michael Winter" <(E-Mail Removed)> skrev i meddelandet
news:OBiMf.26795$(E-Mail Removed). uk...
> 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.



So is the latter the correct form although the former is tolerated?
Is
#sverige.subsection a=
<a class="subsection" id="sverige"> ?

--
Luigi Donatello Asero
https://www.scaiecat-spa-gigi.com/sv/faktaomitalien.php
今天二零零*年二月二十七日
星期一



 
Reply With Quote
 
Steve Pugh
Guest
Posts: n/a
 
      02-27-2006
"Luigi Donatello Asero" <(E-Mail Removed)> wrote:

>Is
>#sverige.subsection a=
><a class="subsection" id="sverige"> ?


No. And surely you've seen enough CSS by now to understand something
as basic as a descendent selector? Ignore the order of the #sverige
and .subsection, would you ask whether "#sverige a" matched <a
id="sverige"> or whether ".subsection a" matched <a
class="subsection">?

#sverige.subsection a
is the selector for
<foo class="subsection" id="sverige"><a>

The selector for <a class="subsection" id="sverige">
would be
a#sverige.subsection

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <(E-Mail Removed)> <http://steve.pugh.net/>
 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      02-27-2006
On 27/02/2006 15:25, Luigi Donatello Asero wrote:

> "Michael Winter" <(E-Mail Removed)> skrev i meddelandet
> news:OBiMf.26795$(E-Mail Removed). uk...


[snip]

>> The reason why
>>
>> .subsubsection#sverige a
>>
>> fails is because the id selector follows the class name.
>>
>> #sverige.subsubsection a
>>
>> will be accepted.

>
> So is the latter the correct form although the former is tolerated?


As far as the grammar for CSS 1 is concerned, yes. For CSS 2 (and
later), the order is not important and the selectors are equivalent.

> Is
> #sverige.subsection a=
> <a class="subsection" id="sverige"> ?


No, see Steve's reply.

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
 
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