Answer the question
In order to leave comments, you need to log in
How to organize writing css?
Good day to all. I've been typing for two years now, I have a small portfolio, I can do a lot of things... but what I still can't come to is the organization of my CSS code. I get a binding to the HTML structure, i.e. at the top css start at header and down to footer. But it seems to me not very modern and adapted to work in a team.
I read a lot about code organization methodologies like BEM, atomic CSS, SMACSS. But I can’t really get into them how they all share this. I read a lot of comments and watched someone else's CSS in which, for example, people first describe the appearance of buttons, set colors with variables ... I
also read that it is more correct in css to separate the design and arrangement in styles, i.e. color: ... separately, and position: ... separate classes.
In general, the essence of the question ... Tell me who writes his css?! Articles, advice, comments, recommendations.
How to get used to linking css to html structure?!
Answer the question
In order to leave comments, you need to log in
Tell me the best way to make projects. Can you suggest other development approaches?Which is better - depends on the specific case, but when I was doing layout it looked something like this:
I read a lot about code organization methodologies like BEM, atomic CSS, SMACSS. But I can’t really get into them how they all share this.
You will not be able to decouple the code from the html structure, because they are written for your document. no matter how you would like to see "general" your code.
You can layout in a modular way (in general, BEM implies this), that is, you have a header block - create something like css/header/style.css , js/header/scripts.js and already work in them.
About the buttons. using SASS you will not be able to write styles in a different way, as other people do:
1. the button is written, .button
2. the color classes are written.
In SCSS it looks like this:
.button {
&__black {}
&__white {}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question