On 2015-01-17 11:16, Sebastiaan Koppe wrote:
What would be the benefit? Applying styles per page seems like a lot of
workload for only one page.
It's not, at least not with a sane server side framework.
If you have an element that is only available on a specific page and you
want to style that.
<body id="foo">
<table>
...
</table>
</body>
body#foo table {
background-color: red;
}
Or alternatively:
<body>
<table id="foo">
...
</table>
</body>
table#foo {
background-color: red;
}
If you have several element that needs this kind of styling you only
need to add one "id", to the "body" tag. Instead of to each individual
tag. This also works great with Sass, which support nested rules:
body#foo {
table {
background-color: red;
}
ul { ... }
}
What if you want those styles to be applied on another page? Seems messy to me.
Then you obviously don't scope the styling for only that page ;). It's
also possible to add multiple selectors for a given set of CSS rules. If
you're using something like Sass you have many options with reusability,
like mixins, inheritance, functions and so on.
--
/Jacob Carlborg