html - Firefox 不显示 Logo ,而 Chrome 显示

标签 html css google-chrome firefox

我有以下 CSS:

 #logo{
    content: url(../images/logo.svg) 0 0 no-repeat;
    background-color: black;
    margin-top: 30px;
    height: 20px;
    width: 100px;
  }
  #logo-container{
    background-color: black;
    margin-top: 0px;
    height: 65px;
    width: 100px;
  }

用那个 html:

<div class="col-md-1 col-md-offset-1 col-xs-3 ">
                <div id="logo-container"><a id="logo" href="#firstpage" data-target="start" title="EPIC Companies"></a></div>  
            </div>

Chrome 正确显示 Logo ,而 Firefox 显示黑色矩形(仅容器)。我做错了什么?

最佳答案

content 只能用在伪元素中,例如 :after:before

所以这样使用它:

#logo:after {
    content: url(../images/logo.svg) 0 0 no-repeat;
    background-color: black;
    margin-top: 30px;
    height: 20px;
    width: 100px;
}

关于html - Firefox 不显示 Logo ,而 Chrome 显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23541661/

相关文章:

html - 网格模板不适用于 Mac 上的 Chrome 或 Mozilla

html - CSS nth child - 在 href 中选择错误的 span 元素

javascript - js/css的几何效果

jquery - javascript 滚动滞后 - Chrome

google-chrome - Chrome REST 客户端如何在不设置 CORS header 的情况下工作?

javascript - 自动换行功能在 chrome 中不起作用

html - Bootstrap 自定义导航栏折叠按钮未显示

jquery - Wordpress Navbar - 折叠按钮未出现 Bootstrap

html - <div> float : left not going left

java - 无论屏幕大小如何,都需要图像来保持位置