Why are dashes preferred for CSS selectors / HTML attributes?

后端 未结 6 1774
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 00:07

In the past I\'ve always used underscores for defining class and id attributes in HTML. Over the last few years I changed over to dashes, mostly to align m

6条回答
  •  我在风中等你
    2020-11-28 01:06

    I think it's a programmer dependent thing. Someones like to use dashes, others use underscores.
    I personally use underscores (_) because I use it in other places too. Such as:
    - JavaScript variables (var my_name);
    - My controller actions (public function view_detail)
    Another reason that I use underscores, is this that in most IDEs two words separated by underscores are considered as 1 word. (and are possible to select with double_click).

提交回复
热议问题