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

后端 未结 20 2170
谎友^
谎友^ 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 09:12

    It depends, sometimes it makes sense just to add a class to let an element float. The problem with the semantic approach is that you will end up ball of mud of css classes. Sure, names like redLink or blackHeader have to be banned but sometimes you will need little helpers like "clear" or "floatLeft".

    Read this article of Nicole Sullivan who explain this in deep.

提交回复
热议问题