【问题标题】:how to change an image with pure css in the nav bar when scrolling?滚动时如何在导航栏中使用纯css更改图像?
【发布时间】:2018-05-26 22:38:26
【问题描述】:

当导航栏将其状态更改为固定时,我已经更改了链接的文本颜色。我之前正在阅读一个答案,但它不起作用:Is it possible to set the equivalent of a src attribute of an img tag in CSS?

以下代码显示了“logo.png”图像的位置,该图像在滚动时会发生变化。谢谢

<div class="logo-box">                             
    <div class="logo">
        <a href="#">
            <img src="images/logo.png" alt="">
        </a>
    </div>
</div>

【问题讨论】:

    标签: html css


    【解决方案1】:

    没关系,我自己解决的,忘记把fixed nav bar =等于scrolling的属性了。

    .main-header.fixed-header .main-box .logo-box .logo img{
        height: 50px;
        content: url("../images/logo.png") !important;
    }     
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-10
      • 2021-10-28
      • 2017-12-27
      • 1970-01-01
      • 2019-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多