Hacker News new | ask | show | jobs
by nudetayne 4598 days ago
From what I see in the CSS files, you already prefixed (edit: by prefixed, I mean child selectors) everything with the character's name, which is where my confusion comes from. Either everything should use class selectors, or characters should use a class selector and the constituent body parts should be ID selectors.
1 comments

but then wouldn't document.getElementById() calls get confused, even though your IDs are nested?

Shouldn't it be the other way around?

    #homer .left-eye { ... }
    #bart .left-eye { ... }
makes more sense to me than

    .homer #left-eye { ... }
    .bart #left-eye { ... }

  .homer #left-eye
This indeed makes (almost) no sense. It makes no sense for sure if you intend to have several characters on the page — id must be unique, and it does not matter that something is in front of it.

.some-class #some-id makes sense only if you want to style page-unique elements differently in some cases but even in that case I'd argue that #some-page-id #some-id would be better (assuming #some-page-id is the body element id).

The calls to JavaScript functions that are ID-based would certainly not work. But there are many ways to access them that wouldn't.

In regard to the selector type, does Homer have more than one left eye? More than likely not, but that's why I suggested using all class selectors as an option. Using all class selectors would enable you to produce (a) as many Homers as you'd like and (b) as many left eyes, right eyes, mouths, etc as you'd like.