【问题标题】:Bootstrap4 navbar/navbar-brand and SVGBootstrap4 导航栏/导航栏品牌和 SVG
【发布时间】:2018-03-28 14:54:28
【问题描述】:

无论现在我如何设置这个样式,我都无法使用 Bootstrap 4 让图标以我想要的颜色出现在固定顶部导航栏中。我尝试了填充/颜色属性:

<script src="static/js/bootstrap.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="static/css/bootstrap.min.css" type="text/css" />
<nav class="navbar navbar-expand-sm navbar-dark fixed-top bg-dark">
   <div class="navbar-brand">
      <img style="fill:white; width:32px; height:32px;" src="static/images/si-glyph-disc-upload.svg" />
   </div>

【问题讨论】:

    标签: css twitter-bootstrap glyphicons


    【解决方案1】:

    您不能在使用 &lt;img&gt; 标签加载的 SVG 图像上使用 fill 属性。相反,您可以使用 CSS 过滤器属性更改颜色。

    此答案中的示例:https://stackoverflow.com/a/44252082/1115262

    否则,您可以将图像嵌入为内联 SVG:img src SVG changing the fill color

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-10
      • 1970-01-01
      • 2021-05-08
      相关资源
      最近更新 更多