What are your CSS practices?
-
If you like Bootstrap you might also like [Semantic UI](https://semantic-ui.com/). I find their approach a little neater and more expressive.
cheers Chris Maunder
It's appropriately named!
-
Quote:
And for the CSS coding guidelines, I put everything on one line; I don't make it look like a programming function because CSS is not a programming language.
Ha, I do and I don't. Generally depends on the project I'm working on and the mood I'm in where CSS is concerned as to whether they get the "one-liner" treatment or not. But in most cases if I'm defining something that has only 1 - 3 attributes, say for basic
's, then they get put on one line. But if I need something more complex, such as adding gradients or something that needs a lot of attributes, I don't put them on one line (the minifier can deal with that one) because it's simply easier on my eyes to see what I'm doing (classic example - styling stupid form elements... :wtf: )
p { ... }
form { ... }
...
input[type="blah"] {
blah;
blah;
blaaaaaaah;
}
...CSS can be a massive pain for sure, no one can ever deny that one (!!) and get way out of control all to easily, so I stick with a "standard" (more of a personal convention in reality) I've molded for myself over the years that works quite well for me and other's can easily grasp. Urg... haha. Lately though I've been leaving it all to Bulma or Bootstrap and run the other way so I can do the actual work I need to do and deal with it after, not gonna lie
Yea, that is a good idea to add line breaks on complex styles. I'm old school CSS and followed Eric Meyer's style back in the early 2000's, though I do break up complex styles to a certain point. I compare it to SQL. I hate it when I have to fix someone else's select statement and it has 50+ attributes all on separate lines and I have to scroll up and down to just get to the tables.
-
You need to look at LESS or CASS. This lot would become
div.main-menu {
...
a { ... }
div.sub-menu {
... a { ... }
}
}cheers Chris Maunder
did you mean SASS by any chance?