Taking an input parameter for classes from HTML

僤鯓⒐⒋嵵緔 提交于 2019-12-12 06:04:01

问题


I have a regular css class defined in my .less stylesheet called pb-5 which stands for and contains padding-bottom: 5px. I use this class on elements when all they need is that one attribute and it's not worth making a whole class definition, and because it's cleaner than using the style attribute in HTML.

I am wondering if there is a way to take a parameter for my pb-5 class, so it becomes something like pb-@size. Then in my HTML I would be able to attach the class p5-[any number] and css would dynamically be generated to give it the amount of padding specified after the hyphen.

来源:https://stackoverflow.com/questions/28775914/taking-an-input-parameter-for-classes-from-html

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