20

I need help removing the border from the ion-toolbar in the ion-header in Ionic v4 (4.0.9).

My objective is to remove this:

my two toolbars with borders

In my code I have a ion-header with two ion-toolbar. I've tried everything the no-border attribute inside ion-header and ion-toolbar.

I've also tried adding the attributes to the .scss of my page like the following:

<ion-header no-border-bottom no-border-top no-border>
  <ion-toolbar color="dark" no-border-bottom no-border-top no-border>
    <img src="../../assets/icoUserLogin.png" alt="Logo Aikox" slot="start" witdh="20%" />
    <ion-title slot="primary">
      Test
    </ion-title>
  </ion-toolbar>
  <ion-toolbar class="ToolbarVerde" color="medium" no-border-bottom no-border-top no-border>
    <ion-buttons slot="start">
      <img src="../../assets/icoListado.png" alt="Icono Listado" slot="start" width="70%" />
    </ion-buttons>
    <ion-title>
      <span>test</span>
      <br />
      <span>test</span>
    </ion-title>
    <ion-buttons slot="primary">
      <ion-button (click)="Nuevo()">
        <img src="../../assets/icoRefresh.png" alt="Icono Recargar" width="70%" /><br />
      </ion-button>
      <ion-button (click)="Nuevo()">
        <img src="../../assets/icoNew.png" alt="Añadir Parte de Trabajo" width="70%" /><br />
      </ion-button>
    </ion-buttons>
  </ion-toolbar>
</ion-header>
.toolbar-background{
    --border-width: 0px !important;
    border: 0 !important;
}
.toolbar-container{
    --padding-top: 0px !important;
    --padding-left: 0px !important;
    --padding-right: 0px !important;
    --padding-bottom: 0px !important;
    padding-top: 0px !important;
    padding-left: 0px !important;
    padding-right: 0px !important;
    padding-bottom: 0px !important;
}
.ToolbarVerde{
    --padding-top: 0px !important;
    --padding-left: 0px !important;
    --padding-right: 0px !important;
    --padding-bottom: 0px !important;
    padding-top: 0px !important;
    padding-left: 0px !important;
    padding-right: 0px !important;
    padding-bottom: 0px !important;
}

But this is not working.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Juanfri Lira
  • 423
  • 3
  • 7
  • 17

6 Answers6

61

In case any one is looking for Ionic 5 solution, do this:

<ion-header class="ion-no-border">
</ion-header>

It removes border and shadow.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Abdul Hafeez
  • 636
  • 5
  • 7
33

Hi this might help someone

<ion-header no-border >

</ion-header>

this remove the line in ionic4

Yokesh Varadhan
  • 1,636
  • 4
  • 21
  • 47
10

Use this to remove the shadow:

ion-header {
  &.header-md:after {
    background: none;
  }
}
Marcelo Ribeiro
  • 331
  • 3
  • 6
6

Use this to remove the border:

ion-toolbar {
  --border-style: none;
}
2

Finally got it, for anyone having problems with this:

Add a class to your <ion-toolbar class="ToolbarVerde", then in your .scss use the following:

.ToolbarVerde{
    --padding-top: 0px !important;
    --padding-start: 0px !important;
    --padding-right: 0px !important;
    --padding-end: 0px !important;
}
Braiam
  • 1
  • 11
  • 47
  • 78
Juanfri Lira
  • 423
  • 3
  • 7
  • 17
1

<ion-content [fullscreen]="true">