Should css class names like 'floatleft' that directly describe the attached style be avoided?

后端 未结 20 2174
谎友^
谎友^ 2020-12-13 08:32

Lots of websites use class names like floatleft, clearfloat, alignright, small, center etc that describe the

20条回答
  •  孤街浪徒
    2020-12-13 08:58

    Andrew; it's good to give sensible name to an class & id which easy to understand for you & your fellow member's which are working on that project. For me classes small , center , floatleft etc define nothing to me because when you give class center that's indicate that the element on the center but there are other properties also in that class like color, background etc

    For example

    lorem
    css: .center{margin:0 auto;}

    in this example class center don't clear to me. but we can use them as a helper class.

    For example

    lorem
    css: .center{margin:0 auto;}

    from above example now it clear to me what the role of class center in that panel div

    FOR MORE CHECK THESE LINKS :

    What's the best way to name IDs and classes in CSS and HTML?

    http://www.ronniesan.com/blog/entry.php?title=organizing-your-dom-elements-with-the-proper-ids

    http://cssglobe.com/post/3745/my-top-10-most-used-css-class-names

提交回复
热议问题