Dynamic class to element with Less

孤人 提交于 2019-12-24 12:01:08

问题


I am using bootstrap.less and i want to add class="table table-striped table-hover" to all tables. Is it possible to achieve this?

I want to add something like:

table {
   //Add class here
}

回答1:


If I understand you correctly, I believe you're looking for:

table {
  .table;
  .table-striped;
  .table-hover;

  /* Any other default table styles */
}

While you can't add class="table table-striped table-hover" to each element (that's more in the JS-realm), you can get the same effect by using the other classes as mixins added to the default table element's styles. See the LESS documentation for more examples.



来源:https://stackoverflow.com/questions/27617789/dynamic-class-to-element-with-less

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!