CSS - @import rule

> (World Wide) Web - (W3|WWW) > CSS - Cascading Style Sheets - Markup Language (HTML|XML) Skin

1 - About

Import permit to add an extern CSS file into a CSS file.

The @import rule allows users to import style rules from other style sheets

You can also import a css file through the HTML link element

This statement has a cost as it seems to make always an an HTTP request.

Advertising

3 - Syntax

@import "mystyle.css";
@import url("mystyle.css");

4 - Example

Import of bootstrap:

@import url('//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css');
 
// Add a custom rules here
.container {
    margin-top: 10px;
}
<!-- And we can use the bootstrap CSS rules -->
<button type="button" class="btn btn-info">A bootstrap Button</button>

5 - Documentation / Reference

web/css/import.txt ยท Last modified: 2019/02/09 11:40 by gerardnico