How to pass parameters to css classes

前端 未结 8 2094
我在风中等你
我在风中等你 2020-12-08 09:57

I want to know is it possible to add some flexibility to css via this:

where .round i

8条回答
  •  自闭症患者
    2020-12-08 10:25

    You could do something similar but not exactly the way you've put it.

    CSS

    .radius{
        border-radius: 10px;
        border: 1px solid red;
    }
    
    .r5{
        border-radius:5px;
    }
    

    HTML

    Hello World

    Hello World

    Working Example

    In the example above the red border will be retained but the border-radius will change.

    Note that you don't start class names with numbers, hence r5 rather than 5

提交回复
热议问题