I usually start by writing a base code snippet (including common elements that both Windows and Mobile will have). Then, I separate specific elements such as width, height, font-size, and display style (often horizontal for desktop and vertical for mobile). This is the only method I can think of to make the CSS snippet as concise as possible.
Can you guys tell me how to make my css more concise and easier to maintenance?
This is how I format a simple container:
.container {
border: 1px solid rgba(255, 255, 255, 0.1);
color: #fff;
background-color: var(--container-bg);
backdrop-filter: blur(10px);
font-family: text;
}
/* Mobile */
.mobile .container {
margin: 0 auto;
padding: 10px;
border-radius: 10px;
font-size: 0.9rem;
}
/*Windows*/
.win .container {
margin: 0 auto;
padding: 15px;
border-radius: 15px;
font-size: 1.2rem;
}