How could I get the number of items in a dynamic list with Sass?

杀马特。学长 韩版系。学妹 提交于 2020-04-07 06:04:27

问题


<ul>
  <li></li>
  <li></li>
  <li></li>
  ...
  <li></li>
</ul>

Is it possible to get the 'n' value o the last item of a dinamic list with Sass? Like counting the number of items within the 'ul' using the @each or @for statements ?


回答1:


No. Sass only compiles to CSS. It is never sent to the browser. It has no knowledge of the DOM.



来源:https://stackoverflow.com/questions/28129352/how-could-i-get-the-number-of-items-in-a-dynamic-list-with-sass

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