Home  >  Article  >  Web Front-end  >  How to Import CSS Files into LESS Files?

How to Import CSS Files into LESS Files?

Patricia Arquette
Patricia ArquetteOriginal
2024-10-30 23:38:29385browse

How to Import CSS Files into LESS Files?

How to Import .CSS Files into .LESS Files

Importing .CSS files into .LESS files is possible, but requires specifying an option to force the interpretation of the file as CSS.

Solution:

To import a .CSS file into a .LESS file, use the following syntax:

@import (css) "path/to/style.css";

This will instruct LESS to interpret the specified file as CSS. For example:

@import (css) "../style.css";

.small {
    font-size:60%;
    .type;
}

After specifying the import option, the .LESS file will successfully reference classes and styles defined in the imported .CSS file.

Additional Note:

Keep in mind that you can also specify a different file extension when using the import option, such as:

@import (less) "lib.css";

This will import the lib.css file and treat its contents as LESS.

The above is the detailed content of How to Import CSS Files into LESS Files?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn