[英]background-color on body css doesn't work
I'm trying to edit my app.scss
on my Symfony 4 project. 我正在尝试在Symfony 4项目上编辑app.scss
。
But the background-color
doesn't work. 但是background-color
不起作用。
body {
background-color: #ccccff;
}
On my base.html.twig, I've this : 在我的base.html.twig上,它是这样的:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
{% block title %}Welcome!
{% endblock %}
</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/app.scss" rel="stylesheet">
<link crossorigin="anonymous" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" rel="stylesheet"> {% block stylesheets %}{% endblock %}
</head>
<body>
{% include "components/sidebar/sidebarHeader.html.twig" %}
<div class="col-md-12"> {% block body %}{% endblock %}
</div>
{% include "components/sidebar/sidebarFooter.html.twig" %}
{# TODO: Trouver un moyen d'insérer <script src="/js/jquery.min.js"></script> au lieu du footer sidebar #}
<script src="/js/popper.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
{% block javascripts %}{% endblock %}
</body>
</html>
The only solution that is working is to edit directly the bootstrap.min.css
. 唯一有效的解决方案是直接编辑bootstrap.min.css
。
However, if I edit my app.scss
, if it is after my bootstrap.min.css on the base.html.twig, why it doesn't work ? 但是,如果我编辑app.scss
,如果它在base.html.twig上的bootstrap.min.css之后,为什么它不起作用?
Thanks for your help ! 谢谢你的帮助 !
You have this in your code example... 您的代码示例中有这个...
<link href="/css/app.scss" rel="stylesheet">
However, a browser doesn't know what to do with it, since it's pre-compiled css. 但是,由于浏览器是预编译的CSS,因此不知道如何处理。 You need to replace that line with: 您需要将该行替换为:
<link href="/css/app.css" rel="stylesheet">
And actually compile the scss file using Sass . 并实际上使用Sass编译scss文件。 Make sure the compiled css file is in the same location as the Sass file, or you'll need to change the path. 确保已编译的CSS文件与Sass文件位于同一位置,否则您需要更改路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.