What is the best Approach for CSS framework of an Enterprise Cloud application?

前端 未结 3 2205
一整个雨季
一整个雨季 2021-02-19 14:05

There are several ways to style the elements in each page, in Enterprise applications usually the CSS Framework size increased about 1 MB, and when your users a

3条回答
  •  伪装坚强ぢ
    2021-02-19 14:32

    I always go with the 2nd approach, because:

    1.It's easier to maintain, you never know when you'll edit your pages. So for example if you give your elements a class of my-color and you wanted to change that after a while, all you need to do is to go to your css file and change my-color color, Imagine the time you save, and of course time means money.

    2.You don't repeat your style, and that'll lead to less .css file size, and thus a a faster website.

    3.You can make your .css stucture once, and then reuse it in every project. You'll have to change the style only. For example, you can have .my-color in every project with different style. Instead of making it from scratch each time.

    The drawback is you'll have a larger .html pages, but usually browsers cashe your page and

    in many cases the amount of loss in markup performance will be greatly surpassed by the amount of gain in stylesheet performance

    Quoted from http://www.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/

    This approach is called OOCSS = Object Oriented Cascade Style Sheet, it isn't considered a best practice yet, but it's evolving.

    You can read more here

    http://oocss.org/

    http://www.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/

提交回复
热议问题