OOCSS
As far as I know, the OOCSS (Object-Oriented CSS) convention says it’s best to create a library with separate CSSS components.
Therefore, in an exemplary way, one should create a separate style sheet for each component of a project, such as buttons, navbar, Typography, etc...
Graphic example:
root
|
+-- index.html
|
+-- css/main.css; buttons.css; navbar.css; typography.css...
|
+-- js/
Fictitious situation with buttons
That way, if your need was to apply breakpoints (media queries) to buttons, you would create a Buttons.css file that would contain the rules for the various sizes of buttons.
What the style sheet of a button component would look like:
.btn {
width: x;
}
@media only screen and (max-width: 682px;){
.btn-y {
width: y;
}
}
@media only screen and (max-width: 960px;){
.btn-z {
width: z;
}
}
Completion
Modulate your CSS so that each component has its own CSS. So within each style sheet use the breakpoints for the given component.
Still about style sheets, notice that I talked about OOCSS in a shallow way, so I recommend that you research on the subject.
Also, do not take into account the comment of those who speak to use Bootstrap, after all, has no relation to your doubt.
Ps: I have difficulty expressing myself. So, if you still have doubt, comments.
Edit 1: This situation, which I mentioned, applies only at the development stage. Therefore, you would have to use something like preprocessors to combine everything, when finishing the development.
Edit 2: @hugocsl brought this link which explains how to behave, when publishing.
There is a pattern yes, it’s called BOOTSTRAP. Have you ever heard of?
– LeAndrade
In this case it’s a framework, and I don’t want to go into this approach, I want to apply some pattern to my project that isn’t a framework, and from what I saw in the bootstrap documentation, they follow a pattern, only of them using mixins to create the breackpoints. But thank you so much for the tip.
– Leandro carra
Possible duplicate of What type of measure is used when building a site for width, height, etc...?
– hugocsl
@Leandro and Bootstrap is standard of what? Not even Bootstrap 3 and 4 have the same values as Breacking Point in Media Querie... as it will be standard for anything. Not even Bootstrap he asks... there’s a million more Grids out there, don’t get stuck with Bootstrap
– hugocsl
Amigo @hugocsl, this question I raised here is not a duplicate of what you put as a suggestion, because there the question is about measures and my question is about pattern of creation and application. And in this matter of bootstrap being a standard, no one said that it is a STANDARD, I said that they have the THEIRS standard and that’s what I’m trying to understand here, if THERE is any standard for implementing media queries or each one does it the way you think best.
– Leandro carra
as a Hare of yours, I will comment here just because there are 2 more Leandros commenting here and what the first commented has nothing to do, alias... disregard
– Leandro RR
@hugocsl I wanted to be a little sarcastic, because Bootstrap is the one that governs the CSS architecture of most hj sites. And it is unthinkable hj in day you work professionally without the aid of frameworks.
– LeAndrade
About whether there’s a pattern I think it’s clear in the other question that there’s no pattern. About Bootstrap I just made a comment about who thinks Bootstrap is mandatory and in the case is not, it’s just another Grid like any other. About Csss may have good practice regarding indexing, but not about the size of Querie Media
– hugocsl
I haven’t used bootstrap for a long time... only if it’s for codating an admin panel, other than that, it’s not mandatory for layouts
– Leandro RR
Leandro thanks for the sarcastic reply ... helped me a lot. Thank God there are people like @hugocsl and Leandro Ruel to help people who don’t know anything.
– Leandro carra
Leonardo since you are starting, don’t get attached to "crutches" enjoy and study how to do things in hand first. Half of Bootstrap’s questions here on the site are from people who from crtl+c and Ctrl+v and then can’t do what they want because they have no idea what they’re doing. It starts with the base, and not with ready-made model that you don’t understand. It’s only a tip if you intend to take the studies forward.
– hugocsl
Guy what I want from the beginning to say is that wanting or not you WILL HAVE to learn to deal with Bootstrap, Materialize, Bulma, etc... Any company that wants to have productivity in developing layouts use them. Like the boy said up there that Bootstrap is not mandatory, I’m not and he doesn’t decide that’s the market.
– LeAndrade
@Leandro Mandatory or not you will not be able to use a tool productively unless you realize the things she is doing.
– Isac