用bem命名导航下拉列表

时间:2015-08-30 14:19:46

标签: css bem

哪个是用bem命名下拉菜单的最佳方法?使用儿童nav-main__sub或修改器nav-main - sub ??

<ul class="nav nav-main">
<li class="nav__item">
    <a href="#" class="nav__link is-active">home</a>
</li>
<li class="nav__item nav__item--sub-nav">
    <a href="#" class="nav__link">About</a>
    <ul class="nav nav-main--sub">             
        <li class="nav-main--sub__item">
            <a href="#" class="nav-main--sub__link">Company</a>
        </li>
    </ul>
<li class="nav__item">
        <a href="#" class="nav__link">Contact</a>
</li>

1 个答案:

答案 0 :(得分:2)

恕我直言<ul class="nav nav--main"> <li class="nav__item nav__item--sub-nav"> <a href="#" class="nav__link">About</a> <ul class="nav nav-main__sub"> <li class="nav-main__sub-item"> <a href="#" class="nav-main__sub-link">Company</a> </li> </ul> </li> </ul> ,因为它不是修饰语。

<ul class="nav nav--main">
    <li class="nav__item nav__item--sub-nav">
        <a href="#" class="nav__link">About</a>
        <ul class="sub">             
            <li class="sub__item">
                <a href="#" class="sub__link">Company</a>
            </li>
        </ul>
    </li>
</ul>

或更容易:

      COPY res_partner(name, website,email,phone)
      FROM '/home/ubuntu/sample/data.csv'
      WITH DELIMITER ','
      CSV HEADER;

     templ=# SELECT count(*) FROM res_partner;
     count 
     -------
     25647
    (1 row)