Wednesday, July 4, 2007

Minimization of Redundant Code

Hey there, just another coding rant:

CSS does wonderful things for html, especially with it's ability to create advanced links between styles and tags.


Here's an example where it can reference multiple classes to multiple tags, mix and match style.

.class1 {
...
}
.class2 {
...
}
.class3 {
...
}

[tag1 class="class1" /]
[tag2 class="class1 class2" /]
[tag3 class="class2 class3" /]

Another good thing to keep in mind is how to apply classes to nested tags:

before:


[tag1 class="class1"]
[tag2 class="class2"]
...
[/tag2]
[/tag1]


after:
[tag1 class="class1 class2"]
...
[/tag1]


Doesn't work 100% everywhere, use trial and error.