简体   繁体   English

ion-navbar背景图片不显示-仅显示白色-Ionic 3

[英]ion-navbar background image not appearing - showing only white - Ionic 3

I have an ion-header section like this: 我有一个ion-header部分,如下所示:

<ion-header (swipeRight)="toProfile()">
  <ion-navbar #clickme class="itemadspace" [@slideDown]="downState" no-lines no-padding>
    <h3 class="feedtitle">Stylist Feed</h3>
    <div (tap)="loadPost()" class='pluscontainer'>
      <ion-icon class='plussy' name="add"></ion-icon>
    </div>
  </ion-navbar>

  ...

</ion-header>

The CSS for ion-navbar is the itemadspace class is: ion-navbar的CSS是itemadspace类,它是:

    .itemadspace {
        z-index: 1;
        position: fixed;
        top: 0;
        left: 0;
        background-image: url('../../assets/tresemme.png');
        background-repeat: no-repeat;
        background-size:cover;
        text-align: center;
    }

No image shows, the background for the ion-navbar component is white. 没有图像显示, ion-navbar组件的背景为白色。 Any idea how to get the background image to work? 知道如何使背景图片正常工作吗?

INstead of adding as class. 而不是添加为类。 you can overwrite the theme. 您可以覆盖主题。 You can add this code in variable.scss at bottom. 您可以在底部的variable.scss中添加此代码。

ion-header{
    ion-navbar{
        div.toolbar-background{
             background-image: url('../../assets/tresemme.png');
             background-repeat: no-repeat;
             background-size:cover;
             text-align: center;
        }
    }
}  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM