You are not logged in.
Pages: 1
ok, I'm not visually inclined... I have some css questions.. about stuff I don't understand.
Why is it better to do:
tr.headingRow {...}
than:
.headingRow {...}
yeah I understand that there's implied usage in the first example... but really, it's not going to cause issues...
Number two... why do people insist on stuff like this:
tr.headingRow td img.customImg { ... }
over:
img.customImg { ... }
Now, I can understand the nesting, only use the customImg inside the headingRow and a td... but, come on people... that's just so restrictive to me... what if you move that td out to a div? you now have to change your stylesheet as well... but with example #2 nothing changes...
some of the stuff I see is rediculous...
td.blah { color: white; }
div.abracadabra { color: white; }
span.customSpan {color: white; }
... etc ...
and this could all be replaced with:
.white { color: white; }
and you save a mess of lines...
so, wtf... can someone explain this to me... who deemed this "proper" usage?
Offline
You should use it only when needed of course, if plain .something {} works then it's just stupid.
As far as I know it's mainly used to override an existing rule. e.g. a global td rule to markup all td's in one sweep, and then specific .something rd {} rules to single certain exceptions out.
I've had once a css-only dropdown menu implementation (thus avoiding JS), and there the more obscure things are really needed, but IE didn't eat it.
Offline
No idea. I generally make my scopes large as well.
I mean, it is not like I run out of names for things, it is not like I am trying to encapsulate things in an OO paradigm (no data hiding possible in css), and I generall prefer simplicity to excessive verbosity.
I only use the nesting to classify elements that I don't name.
'tbody div' for example. But never for named objects. That is just silly to me.
heh. Silly phrakture. Inducing me to rant.
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
see that's what I was thinking - only use nesting when non-id'd - but then you see stupid stuff like:
table tr td { ... }
...sigh....
I think the problem I have wrapping my head around what people do sometimes is that I forget "web designer != developer" and these people don't think like someone who knows how to code...
i generally have a whole mess of .someRule rules, and rarely classify them by element type
Offline
yeah. occasionally I will do something equally stupid like..
#foo div {}
lol.
*shakes head and goes back to his corner*
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
I never even heard of
.something {}
I guess they skipped that option in the webdesign course at my school.
A bus station is where a bus stops.
A train station is where a train stops.
On my desk I have a workstation.
Offline
the "." names apply to <tag class="something" />
"." is for the class attribute
Offline
I can only imagine this could be useful with very very complex webpages as a kind of optimisation (?). But this would also introduce so much complexity with scripting that It could only make programming more difficult IMO.
I'm mostly using .something {} syntax and it's clear and optimised enough for me.
Offline
the "." names apply to <tag class="something" />
"." is for the class attribute
Ooh OK. So
.fancymenu { }
would work for
<p class="fancymenu">blah</p>
<div class="fancymenu">blah</div>
<ul class="fancymenu">blah</ul>
...
That's actually pretty cool.
A bus station is where a bus stops.
A train station is where a train stops.
On my desk I have a workstation.
Offline
yeah, the .something {} is what I use 90% of the time, because I don't need to worry about what element I'm styling...
Offline
Pages: 1