DISQUS

Alcides Fonseca bliki: Alcides Fonseca: LESS CSS

  • Ruben Fonseca · 5 months ago
    SaSS is way cooler - http://sass-lang.com/
  • Dextro · 5 months ago
    True True, CSS could really use variables!
  • trodrigues · 5 months ago
    Well, let me tell you that you are misunderstanding things if you don't know how to apply DRY concepts to your CSS code.

    Colors for instance. You don't need variables at all in order to avoid repetition. In my case, all my colors go in the end of the CSS file. For instance, if I use a #FF0000, I do the following:

    #element1, .someclass, div.someotherclass sometag, whatever, #something {
    color: #ff0000;
    }

    You can see an example here: http://n.ki.sl.pt

    I do the same for font sizes (altough that file doesn't have that yet). As for organization, use comments, learn how to separate things. Place the main layout elements at the top, then have the specific sections CSS, and a section for reusable elements across different sections.

    I seriously think people fail to understand how do organize their CSS code a lot, even designers who probably write 10 times the CSS I do.
  • alcides · 5 months ago
    Tiago, I rather describe each of de element rather than applying properties to a list of them. I organize my CSS like that because I find it more readable (yeah firebug and inspector, I know, I know) and it's even easy for me to write.

    In you code, you will repeat #element1, .someclass, etc... a lot of times, while I repeat colors and font-sizes.

    You're repeating yourself one way or the other. I like CSS to be target-oriented and the only thing I lack is variables. And it's something that wouldn't hurt CSS, would it?
  • Mario Valente · 5 months ago