I'd agree with rorz0r. One place for all the rules that refer to .body
I'd go a little further though and suggest you investigate SASS; CSS is kind of irritating so SASS (or LESS, if you must) makes writing styles much more pleasant.
In that case you can separate your font styles and bg image styles in a sensible way; and the SASS/LESS compiler will sort it out for you.
I think I know what you're refering to, "seperation of concerns", along the lones of https://www.viget.com/articles/client-side-separation-of-concerns-are-we-doing-it-wrong and http://blog.teamtreehouse.com/the-separation-of-structure-presentation-and-behavior-is-dead
As mentioned you probably want to use SASS or something similar to get this right.
I usually keep my font styling in a seperate css file to the rest of my stuff.
I'm not 100% sure why yet but it works for me
Something else to look at is BEM - http://getbem.com/introduction/
No need to go "all in" on how they're doing it but their naming structure is pretty cool.
Some resources:
https://css-tricks.com/bem-101/
https://www.smashingmagazine.com/a-new-front-end-methodology-bem-blocks-reiteration/
<body class="website-background">
//content
</body>
I just dont like firing up the compiler and stuff for simple jobs I can achieve with a single stylesheet like this.
I don't really understand the question (although it has been a long day) – what's the point of having two rule sets with the same selector?
Also:
1. <3 autoprefixer
2. VS Code > Atom > Brackets.![]()
Yes I'm familiar with all of that, but he wasn't suggesting two different selectors, but instead the same one twice. That is what confuses me.Like you have seperation of concerns in development (MVC, etc), so you get to the stage of your site/app/xxx that you want to have manageable css.
There are a couple of different methods to do this, SASS, BEM, etc and one of them is basically to have your layout rules in a selector and your styling/presentation rules in a different selector: http://www.xaprb.com/blog/2005/12/15/css-good-practice-separate-layout-and-presentation/
Yes I'm familiar with all of that, but he wasn't suggesting two different selectors, but instead the same one twice. That is what confuses me.
Thanks for that BEM link. That is awesome. We have strict naming conventions and structures for everything else, why not css.
One of my favorite things about angular 2 is its use of shadow Dom (native and emulated) to sandbox styles in your components, solving a lot of these issues (unless you go and build one massive component, but then you have other things to worry about)
Agreed, thanks for the link I will be adopting the BEM methodology.
I'm still missing the point
It's a body, it's not something you swap out often (in which case you can just swap out the whole stylesheet). If you wanted to optimize reuse of styles for buttons perhaps, then something like BEM or OOCSS might make sense (like the "btn btn-primary" idea in Bootstrap).
Hi, need some guidance.
If I want to set both the font type and background image of the body tag what would be the most ideal scenario to do so?
This:
View attachment 374803
or This:
View attachment 374805
or Something Else?
I also don't understand why you are separating them :wtf:
BEM is pretty cool but can get super confusing real quick. I think Google used in Material Design Lite.
Also, that line height seems specific. Looks like a magic number to me, check this out:
http://csswizardry.com/2012/11/code-smells-in-css/