Page 1 of 1
Posted: Wed Jan 18, 2017 4:58 am
My style sheets are bloated mainly because so many styles are identical except for one attribute.
Is there a way of encapsulating the commonality?
Posted: Wed Jan 18, 2017 8:41 am
Do you mean an automated way? If so then I am not aware of one but there could be something out there (though I suspect something like this would be very difficult to do automatically without unexpected side effects and other issues).
Otherwise you may have to manually re-design your styles so that they make better use inheritance in order to eliminate or reduce the unnecessary duplicate style properties.
Putting common properties in a separate class might help as well. You could then assign HTML elements that common class plus other classes... but making use of inheritance (if you can) and good design (good CSS classes, etc.) would be the best option.
Posted: Sat Jan 21, 2017 12:49 am
What do you mean by "the cascade"?
Posted: Sat Jan 21, 2017 8:33 am
This explains it well:
https://developer.mozilla.org/en-US/doc ... nheritance
Though it seems I meant to say inheritance (and will update my post). You can use inheritance to limit the amount of properties you set and simplify your CSS.
Posted: Wed Jan 25, 2017 10:02 am