【问题标题】:Wordpress storefront Sticky header with centered menu and logo带有居中菜单和徽标的 Wordpress 店面粘性标题
【发布时间】:2021-08-01 12:39:50
【问题描述】:

我正在为一位朋友开发 wordpress 项目。不幸的是(对我来说),她认为该网站需要粘性标题,这超出了我对 CSS 的实际理解。我创建了可以帮助我将徽标和菜单置于下方的 css。现在我需要帮助,使其具有粘性并在菜单/导航栏位置之间设置徽标。

页眉屏幕 [1]:https://i.stack.imgur.com/Vg3PF.jpg

a:focus {
 outline: 0; 
}
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300&family=Playfair+Display+SC&display=swap');

/* center logo*/
.site-branding{
width:100% !important;
text-align:center;

}
.site-header .site-branding img {
margin: auto;
margin-top: 50px;
margin-bottom: 30px;
max-width: 300px;

}
/* center menu */
nav#site-navigation {
width: 100%;
text-align: center;
margin-right: 0px;
margin-bottom:55px;
font-size: 24px;
font-family: Playfair Display SC;
}
@media (min-width: 768px){
.woocommerce-active .site-header .site-header-cart {
width: 21.7391304348%;
margin: 0 auto;
float:none;
}
.entry-content{
        font-family: Open Sans;
    }
    .h2 {
        font-family: Playfair Display SC;
    }````

【问题讨论】:

    标签: css wordpress storefront


    【解决方案1】:

    您可以将 sticky 和 ​​position : fixed 用于sticky items。

    .sticky {
      position: fixed;
      top: 0;
      width: 100%
    }
    

    【讨论】:

    • 你能指导我如何实现这个 rn 吗?
    • 当然。你能告诉我什么会粘在屏幕上吗?
    • 与我的朋友交谈后,她决定她想要大标题,因为它是 rn(当前标题 i.gyazo.com/f0f4cf4f958f7ee22d0b5826b21fe193.jpg 的屏幕)但在单击菜单位置后,它需要自动加载此子页面后向下滚动。你能帮我解决这个问题吗?
    猜你喜欢
    • 2019-01-24
    • 2018-05-25
    • 2018-02-25
    • 1970-01-01
    • 1970-01-01
    • 2015-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多