31

How I can remove <ion-item> divider? I have the following code to show 4 items in a row:

<ion-row ion-list>
    <ion-col width-25 *ngFor="let player of players">
              <ion-item color="dark">
                  <ion-avatar item-left>
                      <img [src]="photo" class="img img-circle"/>
                  </ion-avatar>
                  {{user.name}}
              </ion-item>
              </ion-col>
            </ion-row>

and the output shows 4 images in a row, as excepted, but each image has a white divider below it. I don't want any divider.

I tried to set style="border:none" but it didn't do it.

Vadim Kotov
  • 7,103
  • 8
  • 44
  • 57
TheUnreal
  • 18,980
  • 36
  • 129
  • 231
  • show the image/screenshot.. Hard to understand... May be `ion-col, ion-row` has some css which is showing the border. – Atul Sharma Dec 29 '16 at 08:57
  • Usually in grid systems there is padding in place to create "air" between the blocks. I think style="padding: 0" on your ion-col element should do the trick. But I think maybe you should rethink the use of ion-row and ion-cols here as it seems a little too complex for your needs. – Benedicte Raae Dec 29 '16 at 09:09

8 Answers8

67

use no-lines

<ion-row ion-list>
    <ion-col width-25 *ngFor="let player of players">
         <ion-item no-lines color="dark"><!-- here -->
              <ion-avatar item-left>
                  <img [src]="photo" class="img img-circle"/>
              </ion-avatar>
              {{user.name}}
         </ion-item>
     </ion-col>
</ion-row>
Suraj Rao
  • 28,186
  • 10
  • 88
  • 94
52

For whatever reason this didn't work for me. But having lines="none" worked great.

For ionic v4

<ion-item lines="none"> </ion-item>

Pulled from ionic docs... https://ionicframework.com/docs/api/list

Suraj Rao
  • 28,186
  • 10
  • 88
  • 94
Rmalmoe
  • 817
  • 9
  • 11
9

For ionic v4, you should use the lines property:

<ion-row ion-list>
    <ion-col width-25 *ngFor="let player of players">
         <ion-item lines="none" color="dark">
              <ion-avatar item-left>
                  <img [src]="photo" class="img img-circle"/>
              </ion-avatar>
              {{user.name}}
         </ion-item>
    </ion-col>
</ion-row>
Team Elite
  • 91
  • 1
  • 3
7

Apply this for Ionic V4. Really it will work.. Happy coding

<ion-item lines="none">
</ion-item>
5

If you want to disable the lines / borders globally on all of your <ion-item>'s, just add the following code to your src/global.scss (default when generating a Ionic v4 App with Angular) of your application.

ion-item {

    --border-width: 0;
    --inner-border-width: 0;
}

The attribute lines="none" on a <ion-item> does nothing other.

Hope it helps someone.

Cheers Unkn0wn0x

Unkn0wn0x
  • 557
  • 5
  • 11
3

I tried with no-line but it didn't work in ionic 4

Only this work for me in ionic 4 :

<ion-item lines="none"> </ion-item>

<ion-list>
 <ion-item lines="none" button detail *ngFor="let note of notesService.notes">
      <ion-label>{{ note.title }}</ion-label>
    </ion-item>
</ion-list>
joelss7
  • 31
  • 2
0

I am on ionic 4, and lines="none" somethimes don't work. So I use this line.

ion-list:not(.list-lines-none) ion-item::before{
    border-width: 0 !important;
}

And this is my ionItem example. (It has hidden error property also)

<IonItem lines="none" detail={false}>
    <IonIcon
        className="w-40 h-40 float-left"
        src="/assets/icon/store-black.svg"
    />
    <IonLabel className="flex flex-col ml-10">
        <h5 className="text-base font-bold m-0 ">Lorem ipsum </h5>
        <span className="text-sm leading-tight">Kratki opis</span>
    </IonLabel>
    <IonIcon
        className=" absolute top-50 right-30 w-15 h-15"
        src="/assets/icon/arrow-right.svg"
    />
</IonItem>
0

use (lines="none") in your ion-item