- This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
Viewing 9 posts - 1 through 9 (of 9 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Which example better?
First Example:
text-h {
text-decoration: none;
}
text-h2 {
text-decoration: none;
font-size: 15px;
}
Second example
text-h, text-h2 {
text-decoration: none;
}
text-h2 {
font-size: 15px;
}
2nd example…if only because it has a smaller file size.
I agree. 2nd example is better. I had always done it the first way for a long time. But as I’ve gained experience, I have come to like the second approach. If you have a lot of styles that overlap, that approach really saves not only space but makes changes a lot easier.
What I usually do is write my code in the way I want each class or ID styled. When I’m finished I’ll go back through and combine the similarities between classes or ID’s (show in example 2).
thanks for comment :)
@ChristopherBurton: why don’t you do that the first time?
Ontopic: second approach
@Vermaas It’s just the way I work. No particular reason.
One more example:
Which example better?
First-example:
background {
background: url(“blabla.png”) no-repeat;
}
Second-example:
background {
background-image: url(“blabla.png”);
background-repeat: no-repeat;
}
Either works.
I tend to use the first option for single background images.
If I have multiple bg images then I find it somewhat easier to comma separate onto individual lines and each property.
background {
background-image:
url(“blabla.png”)’
url(“blafoor.png”);
background-repeat:
no-repeat,
repeat;
}