best practice and speed for repeated elements |
best practice and speed for repeated elements |
turpentyne |
Sep 1 2019, 06:56 PM
Post
#1
|
Group: Members Posts: 1 Joined: 1-September 19 Member No.: 26,980 |
Kind of a general question, but I'm wondering if anyone knows for sure which is best.
When I have a stylesheet where a declaration exists several times, I tend to think I can simplify and clean things up by applying it to multiple classes and Ids at a time. This seems best practice, but I wonder if it's really any faster. example... which is faster, better, best practice? Imagine a scenario where it isn't just three items, but 20 or more. (note: To simplify, I wrote ''several other declarations" rather than a bunch of random declarations.) This: .item1 { width: 100%; /* several other declarations */ } Or this, which I tend to do... but I'm not sure it's really any quicker... sometimes it even seems like it's More lines, though I'm trying to get rid of duplication: .item1, |
pandy |
Sep 1 2019, 07:17 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
You mean quicker to load? One of them would probably turn out to be quicker, if we had a way to measure that. But I doubt there would be any noticeable difference, not even on the slowest of servers with a really slow connection.
I'd go for what you find most readable and the easiest to maintain. |
Lo-Fi Version | Time is now: 25th April 2024 - 10:20 PM |