CSS is FAIL
Jan 16 2009, 5:30 am
By: Syphon  

Jan 16 2009, 5:30 am Syphon Post #1



So I'ma coding the new Blonde Foundation, and apparently, it decides not to recognise the first pseudo-class under a > selector...

That is,
Code
div#subnav > a:first-child:link, a:first-child:visited
{
    color: #d08257;
    text-decoration: none;
}


Doesn't apply the style to a:first-child:link. If I write it twice, it does, to the second one. Like so.

Code
div#subnav > a:first-child:link, a:first-child:link, a:first-child:visited
{
    color: #d08257;
    text-decoration: none;
}


Any pseudo classes I put under it do this, I haven't tried normal classes. Does anyone know why? Is it a Mozilla bug? A CSS bug?

EDIT- Tested in IE. Looks like a CSS bug?



None.

Jan 16 2009, 6:17 pm Kellimus Post #2



Quote from Syphon
So I'ma coding the new Blonde Foundation, and apparently, it decides not to recognise the first pseudo-class under a > selector...

That is,
Code
div#subnav > a:first-child:link, a:first-child:visited
{
    color: #d08257;
    text-decoration: none;
}


Doesn't apply the style to a:first-child:link. If I write it twice, it does, to the second one. Like so.

Code
div#subnav > a:first-child:link, a:first-child:link, a:first-child:visited
{
    color: #d08257;
    text-decoration: none;
}


Any pseudo classes I put under it do this, I haven't tried normal classes. Does anyone know why? Is it a Mozilla bug? A CSS bug?

EDIT- Tested in IE. Looks like a CSS bug?

CSS is Standardized.. IE is not..

Its not the CSS cause its been standardized by the W3C so I am blaming IE on this one cause they're not standardized.



None.

Jan 16 2009, 7:23 pm Forsaken Archer Post #3



I don't see anything wrong.
Test file: [attach=2588]

I believe you are making a syntax error for you to think it's a bug, as you are writing two very different declarations. You probably want this:
div#subnav > a:first-child:link, div#subnav > a:first-child:visited { }
in which case, you will either get your colors or you won't, depending on if your <a> element is truly the first element under the subnav div.
It's probably not though, because your other declarations are working which are an <a> element being the first element of any element.

HTML example?

Oh, and it won't work in IE, at least up until IE 7. I tried getting away using various css2 stuffs on sen before I finally gave up on IE complaints.

Edit: And as far as possible solutions:
If your <a> is is a consistent dom, just transverse it as needed. As if there was a <br /> between the subnav and <a>: div#subnav > br:first-child + a:link or if a is inside another element, div#subnav > *:first-child: > a:first-child:link.
Or if possible, make the link in an empty span/div with it's own name and start from there. <div subnav>blah blah blah <div links><a><a><a></div></div> and switch your subnav css to the new links class.

Also, I hope you realize there will only be one <a> element that would apply to the class you wrote, ever.

Attachments:
test.html
Hits: 3 Size: 0.52kb

Post has been edited 1 time(s), last time on Jan 16 2009, 7:38 pm by isolatedpurity.



None.

Jan 16 2009, 8:58 pm Kellimus Post #4



Quote from name:isolatedpurity
I don't see anything wrong.
Test file: [attach=2588]

I believe you are making a syntax error for you to think it's a bug, as you are writing two very different declarations. You probably want this:
div#subnav > a:first-child:link, div#subnav > a:first-child:visited { }
in which case, you will either get your colors or you won't, depending on if your <a> element is truly the first element under the subnav div.
It's probably not though, because your other declarations are working which are an <a> element being the first element of any element.

HTML example?

Oh, and it won't work in IE, at least up until IE 7. I tried getting away using various css2 stuffs on sen before I finally gave up on IE complaints.

Edit: And as far as possible solutions:
If your <a> is is a consistent dom, just transverse it as needed. As if there was a <br /> between the subnav and <a>: div#subnav > br:first-child + a:link or if a is inside another element, div#subnav > *:first-child: > a:first-child:link.
Or if possible, make the link in an empty span/div with it's own name and start from there. <div subnav>blah blah blah <div links><a><a><a></div></div> and switch your subnav css to the new links class.

Also, I hope you realize there will only be one <a> element that would apply to the class you wrote, ever.

Lol, the anchor tag just has different parameters (or do they call them attributes in HTML?) to it, lol.

Attachments:
test.html
Hits: 3 Size: 0.52kb



None.

Jan 17 2009, 12:47 am Syphon Post #5



Kellimus, if you'd bothered to read, you'd see I'd tested it in Firefox before IE. Also, the w3 CSS validator passes it.

IP, what you typed works exactly the same as the syntax I had... Although I cut it down, because I didn't really need the first-child pseudo. (Mainly, it's not a first-child any more.) now it's

Code
#subnav > a:link, a:link, a:visited
{
    color: #a37347;
    text-decoration: none;
}

#subnav > a:hover, a:hover, a:active
{
    color: #d08257;
    text-decoration: underline;
}


And this works perfectly, but the a:hover and a:link stop getting styled unless I have something before them. This is what is confusing me. It doesn't need to be repeated, it just needs any class before it. p, make it work, for example.

EDIT - For the record
Code
#subnav > a:link, #subnav > a:visited
{
    color: #a37347;
    text-decoration: none;
}

#subnav > a:hover, #subnav > a:active
{
    color: #d08257;
    text-decoration: underline;
}
doesn't work.

Post has been edited 1 time(s), last time on Jan 17 2009, 12:54 am by Syphon.



None.

Jan 17 2009, 12:53 am Syphon Post #6



The HTML it's on is
Code
<div id='subnav'>
        <span id='left'>
        //Title// <span style='font-weight: normal'>by</span> <a href='//authorprofile//'>//Author//</a>
        </span>
        <span id='right'>
        First | Last | Random | Next | Newest
        </span>
    </div>




None.

Jan 17 2009, 1:09 am Syphon Post #7



I'm retarded.

Code
#subnav a:link, #subnav a:visited
{
    color: #a37347;
    text-decoration: none;
}

#subnav a:hover, #subnav a:active
{
    color: #d08257;
    text-decoration: underline;
}


Done.



None.

Jan 17 2009, 1:18 am Forsaken Archer Post #8



I think you want:
#subnav a:link, #subnav a:visited { colors; }



None.

Jan 17 2009, 1:18 am Forsaken Archer Post #9



Fuck you beat me to it while I was testing it to make sure ;o



None.

Jan 17 2009, 1:19 am Syphon Post #10



See my previous post. :P



None.

Jan 17 2009, 1:19 am Syphon Post #11



Fuck you beat me to the ninja'd gloating!

So the moral of the story is, it was disregarding the first part, because it didn't mean anything, and I am horrible at CSS syntax :lol:



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:13 pm]
Oh_Man -- No APM in chess. Computer just outthinks the human by seeing more moves ahead and more permutations
[10:12 pm]
Oh_Man -- U reckon? Kasparov waa defeated by computer decades ago
[05:47 pm]
NimoStar -- If its any consolation, the human brain would still mop the floor with this bot if it wasn't limited by the mechanical interface
[05:34 pm]
NimoStar -- Well. The bot didn't come up with any new strategy. It just has superhuman micro. Hard to beat that. I reckon even the simplest dedicated chess engines are unbeatable for humans now.
[02:13 pm]
Oh_Man -- all g
[10:54 am]
NudeRaider -- Oh_Man
Oh_Man shouted: NudeRaider did u watch the entire video? it's not one game. it's currently dominating the ladder at number 1 position. do ur research first!
Oops, caught me there, no I haven't. :( I was imagining how the game went. Sorry for that. Watching it now. brb
[10:52 am]
NudeRaider -- NimoStar
NimoStar shouted: They were not "Unprepared" that was their fifth loss in a row against the bot. The other replays are also available
that doesn't mean he was prepared. When humans come around with new strategies it often takes weeks until the pros figure out how to shut it down. Oh_Man that's certainly a way more convincing argument for micro being "too good to beat".
[09:43 am]
DiearAnother -- wirefram
[08:35 am]
NimoStar -- Well, pros showed that long ago... half of zerg pros just ling muta rush
[08:35 am]
NimoStar -- " its shown is that you can trade 1000's of apm to make up for lack of strategy"
Please log in to shout.


Members Online: O)FaRTy1billion[MM], Oh_Man