<分区>
编辑:由于 Kobi 对这个 StackOverflow Question 的出色评论,我修改了下面的问题:
有没有人尝试过 Nicole Sullivan 的 Object-Oriented CSS框架还是他们自己的框架?如果是这样,优点/缺点是什么?
是否有任何生产站点使用框架 Object-Oriented CSS?
最佳答案
我在我的大部分样式表中同时使用 OOCSS 和普通 CSS。我认为将 OOCSS 用于排版样式没有意义,但对于列、框和按钮之类的东西,我认为它确实有意义并且它确实有助于(在我看来)使代码更简单。
使用一个相当做作的(而且很糟糕——类应该描述功能,而不是形式)示例:
使用 OOCSS
a.button {display: block; background-color: red;}
a.border {border: 1px solid orange;}
<a class="button border" href="#">My bordered button</a>
<a class="button" href="#">My normal button</a>
使用普通的 CSS
a.button_and_border {display: block; background-color: red; border: 1px solid orange;}
a.button_no_border {display: block; background-color: red;}
<a class="button_and_border" href="#">My bordered button</a>
<a class="button_no_border" href="#">My normal button</a>
如您所见,OO 示例中的 CSS 较少,我个人认为这样更易于阅读。但我想归根结底,这完全取决于个人喜好和编码风格:)
关于css - 有人在使用 Nicole Sullivan 的面向对象 CSS 框架吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1005277/