Reputation: 1635
I have a css file and i want to import another css file inside it. How can I do this in Django ?
This is my style.css file and I want to import owl.carousel.css in it.
@import url("owl.carousel.css");
body {
margin: 0;
padding: 0;
color: #34495E;
font-family: 'Source Sans Pro', sans-serif;
font-size: 14px;
line-height: 21px;
position: relative;
background: #fff;
}
I am using {% load static %} on my template to link style.css but how can import a css inside a css ?
<link href="{% static "assets/css/style.css" %}" rel="stylesheet">
Upvotes: 5
Views: 4853
Reputation: 81
You can also use HTML style and script tags to load something inside your static files.
<style>
@import url("{% static 'path/to/your/file.css')")
</style>
Upvotes: 0
Reputation: 10256
If you want to import a .css
file inside a .css
you will need to use the path, as usual.
@import url('/path/to/your/file.css')
If they are in static folder:
static/styles/file1.css
static/styles/file2.css
/* in file2.css */
@import url('file1.css')
It is not possible to use the django template language inside a .css
file.
Upvotes: 6