Abstraction away from CSS

前端 未结 18 1767
别跟我提以往
别跟我提以往 2021-02-13 10:34

Many frameworks seek to abstract away from HTML (custom tags, JSFs component system) in an effort to make dealing with that particular kettle of fish easier.

Is there an

相关标签:
18条回答
  • 2021-02-13 11:18

    The key to a real understanding of CSS (and the browser headaches) is a solid understanding of the box model used by the CSS Standards, and the incorrect model used by some browsers. Once you have that down and start learning selectors you will get away from browser specific properties and CSS will become something you look forward to.

    0 讨论(0)
  • 2021-02-13 11:19

    You can always use a template engine to add variables and calculated fields to your CSS files.

    0 讨论(0)
  • 2021-02-13 11:19

    CSS takes a bit of time to learn, but the thing I initially found most discouraging was the fact that so many hacks were needed to get all browsers to behave the same way. Learning a system which doesn't adhere to logic seems dumb... but I've clung to the vague belief that there is logic behind each browser's idiosyncrasy, in the form of the W3 spec. It seems that the new generation browsers are slowly coming into line - but IE6 still makes my life hell on a daily basis.

    Maybe creating an abstraction layer between compliant/valid CSS code and the browsers' shoddy implementations wouldn't be a bad thing. But if such a thing was created - would it need to be powered by JS (or jQuery)? (and would that create an unreasonably burden, in terms of processing cost?)

    I've found that it useful to 'level the ground' when scripting with CSS. There are probably loads of different flavours of reset script out there - but using YUI resets has helped me to reduce the number of quirks I'd otherwise encounter - and YUI grids make life a little easier sometimes.

    0 讨论(0)
  • 2021-02-13 11:24

    For CSS frameworks, you could consider YUI Grids. It makes basic layout a lot quicker and simpler, although used in its raw form it does compromise on semantics.

    0 讨论(0)
  • 2021-02-13 11:25

    Also check out BlueprintCSS, a layout framework in CSS. It doesn't solve all your problems, but many, and you don't have to write the CSS yourself.

    0 讨论(0)
  • 2021-02-13 11:26

    What I found works best is to really learn CSS. I mean really learn CSS.

    It can be a confusing language to learn, but if you read enough about it and practice, eventually you'll learn the best way to do things.

    The key is to do it enough that it comes natural. CSS can be very elegant if you know what you want to do before you start and you have enough experience to do it.

    Granted, it is also a major PITA to do sometimes, but even cross-browser issues aren't so bad if you really practice at it and learn what works and what doesn't, and how to get around problems.

    All it takes is practice and in time you can become good at it.

    0 讨论(0)
提交回复
热议问题