Inheriting css class which is located in another file

后端 未结 2 839
Happy的楠姐
Happy的楠姐 2021-01-28 11:58

I am using bootstrap and less.

I want one of my class to inherit from a bootstrap class. The problem is I am using bootstrap from a cdn and don\'t want to have any boots

2条回答
  •  孤独总比滥情好
    2021-01-28 12:26

    The question has been answered by seven-phases-max.

    Less support import of file by url. You just have to tagg it as a less file, like this :

    @import (less) "//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.css";
    

    Example here. Then you can reference to the class imported via url.

    It is working, but inheriting a bootstrap class does not import all of the class feature. I inherited all my input with the class .form-control. Some of the features of the bootstrap form-control where imported (size, rounded corner) and others don't (blue light when selected). More about this here.

    input[type="text"]{
        .form-control;
        width: 50%;
    }
    

提交回复
热议问题