简体   繁体   English

如何将图像作为离子项目的中心对齐

[英]How to align the image as center to the ionic item

I am trying to align the image as an aviator to the ionic item. 我正在尝试将图像作为飞行员对准离子项目。

See below. 见下文。

ionic.page.html

   <ion-content padding>
      <ion-item class="item-profile">
      <img  src= "assets/image/learn/doctor/doctor.jpg" class="profilepic">
      <img src="assets/image/profile/samll-circle.png" class="addPhoto">
      </ion-item>
   </ion-content>

In the above, I am trying to align the image center to the ionic item element. 在上面,我试图将图像中心与离子项元素对齐。 I mean as an aviator. 我的意思是作为飞行员。 But I am getting some same. 但是我也得到了一些。 Please check my CSS below. 请在下面检查我的CSS。

    .item-profile {
       border: 2px solid grey;
       border-style: dashed;
       border-radius: 50%;
       width: 160px;
       height: 160px;
       padding: 0px;
       display: flex;
       margin: 0 auto;
       overflow: hidden;

     .profilepic {
        width: 100%;
       height: 100%;
       position: relative;
       border-radius: 50%;
     }
   }

What is my requirement, 我有什么要求

I need to set the image to the above parent element ('ion-item') as 我需要将图像设置为上述父元素(“ ion-item”),如下所示:

  1. image should be fill 图片应填写
  2. image should be a full showcase 图片应该是完整的展示
  3. image should be inside the outer circle 图片应在外圆内

It's difficult to say without images, but I think the problem is that you open and close the whole .item-profile with .profilepic together (.profilepic takes rules from parent)... It should be separated. 没有图像很难说,但是我认为问题在于,您需要一起使用.profilepic打开和关闭整个.item-profile(.profilepic从父级获取规则)...应该分开。

.item-profile {
   border: 2px solid grey;
   border-style: dashed;
   border-radius: 50%;
   width: 160px;
   height: 160px;
   padding: 0px;
  display: flex;
  margin: 0 auto;
  overflow: hidden;
}

.profilepic {
    width: 100%;
   height: 100%;
   position: relative;
   border-radius: 50%;
 }

Hope I understood you correctly. 希望我能正确理解你。

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

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