当页面向下滚动时,如何防止徽标在固定 header 中调整大小?
How to prevent logo from resizing in fixed header as the page is scrolled down?
我正在使用的主题缩小了菜单和徽标,而当您向下滚动页面时它保持不变。我不知道如何阻止它使徽标变小,我希望它保持相同大小。
我认为这是相关代码:
<a class="logo" style="">
<img class="sd-res logo-normal" width="208" height="82" alt="" src="/wp-content/uploads/2016/01/logo-new1.png" style="max-height: 49.7px;">
添加这行 css 代码:
.header.stuck .logo img {
max-height: 100% !important;
}
每次滚动 window 时,图像的 max-height
都会被覆盖,因此您需要添加 !important
前缀。
我正在使用的主题缩小了菜单和徽标,而当您向下滚动页面时它保持不变。我不知道如何阻止它使徽标变小,我希望它保持相同大小。
我认为这是相关代码:
<a class="logo" style="">
<img class="sd-res logo-normal" width="208" height="82" alt="" src="/wp-content/uploads/2016/01/logo-new1.png" style="max-height: 49.7px;">
添加这行 css 代码:
.header.stuck .logo img {
max-height: 100% !important;
}
每次滚动 window 时,图像的 max-height
都会被覆盖,因此您需要添加 !important
前缀。