When I try to access styles.css, Django loads styles.css but not the files that it loads for itself.
{% load static %}
<link rel="stylesheet" href="{% static 'frontpage/css/style.css' %}">
here is the part of styles.css that I suspect is causing the problem
src: url("../fonts/icomoon/icomoon.eot?srf3rx");
src: url("../fonts/icomoon/icomoon.eot?srf3rx#iefix") format("embedded-opentype"), url("../fonts/icomoon/icomoon.ttf?srf3rx") format("truetype"), url("../fonts/icomoon/icomoon.woff?srf3rx") format("woff"), url("../fonts/icomoon/icomoon.svg?srf3rx#icomoon") format("svg");
It seems that the css file is unable to access the .eot files, but I have no way of knowing because django is showing everything as running smoothly.
I had the same issue and spent a little time searching how to solve it... Follow below what solved this issue for me:
You have to be sure your .ttf file is within any of the STATIC_ROOT paths... eg.:
(eg.: {% static 'fonts/yourfontname.ttf'%}
In your .css file, create the @font-face parameters as show below: eg.:
@font-face { font-family: yourfontname; src: url("../fonts/yourfontname.ttf"); }
Now you just normally include the font name where you need it within the .css file. But at this time WITH quotes!!! eg.:
.logotext { font-family: 'yourfontname'; margin-left: 130px; font-size: 40px; etc...}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.