如何将图像放在离子标签的右侧?

时间:2020-01-30 12:02:09

标签: html css angular ionic-framework

我想在离子标签的右侧放置彩色的whats-app图片,但我不知道该怎么做。 这是我的代码:

<ion-row>
   <ion-col size="10">
     <ion-label position="floating">Contato 1* </ion-label>
   </ion-col>
   <ion-col size="2">
     <ion-img class="whatsapp"></ion-img>
   </ion-col>
</ion-row>

CSS:

.whatsapp {
  height: 20px;
  width: 20px;
  background-image: url("../../assets/whatsapp.png");
  background-repeat: no-repeat;
  background-size: 100%;
  background-position: bottom left;
  }

PS:使用ion-img [src]="assets/whatsapp" /ion-img无效!

enter image description here

我做了@Carlos Del Cura Pascual告诉我的事情,现在我明白了。差不多了。

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试使用flexbox内联对齐项目。 →https://css-tricks.com/snippets/css/a-guide-to-flexbox/

避免使用float或类似的

    ion-row{
      display:flex;
      flex-direction:row;
      justify-content:space-around;
      align-items:center;
      height: /* necessary to give a height to align vertically */
    }
相关问题