我正在使用 Bootstrap 示例之一(仪表板)。我正在使用 Python Flask 部署网站。
正在使用 Flask 成功调用 style.css 文件。
<!-- Bootstrap core CSS -->
<link href="{{ url_for('static', filename ='bootstrap.min.css') }}" rel="stylesheet">
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="{{ url_for('static', filename ='ie10-viewport-bug-workaround.css') }}" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="{{ url_for('static', filename ='style.css') }}" rel="stylesheet">
一切正常,除非我将自己的 CSS 选择器添加到文件并尝试在 HTML 中调用它们。
比如我已经添加了
#profile_picture {
width: 300px;
height: 300px;
border-radius: 150px;
-webkit-border-radius: 150px;
-moz-border-radius: 150px;
}
.flash_msg {
background: #93ff9e;
font-size: large;
font-weight: bold;
}
到 style.css 文件,和
<img id="profile_picture" src="{{user[1]}}">
<li class="flask_msg">{{ message }}</li>
到 html,但没有任何反应。
这是 link to the full style.css文件。
这里是 one of the HTML templates .
这是 t he rest of the repo .
最佳答案
您的 CSS 正在您的 github 上寻找 #profile_picture 的 img 子级。
关于python - 添加到 .css 文件的新 CSS 选择器不起作用;使用 Flask 和 Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45988589/