简体   繁体   English

离子3 - 显示圆形图像

[英]ionic 3 - show rounded image

I'm trying to set a round image at the top of a page (like a profile page). 我正在尝试在页面顶部设置圆形图像(如个人资料页面)。 The image is rectangular and about 300x200. 图像是矩形的,大约300x200。 I've tried these ways: 我试过这些方法:

1) Using the Ion-Avatar Tag 1)使用Ion-Avatar标签

2) Using Ion-Image tag, setting the border radius in the scss 2)使用Ion-Image标签,在scss中设置边框半径

None of these methods worked. 这些方法都不起作用。 The image just kept showing squared (and eventually shrinked) inside a grey circle: 图像只是在灰色圆圈内显示平方(并最终收缩):

在此输入图像描述

Any suggestions? 有什么建议么?

you can try with css 你可以尝试用CSS

 .image { height: 5vw; width: 5vw; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 5px gray; display: inline-block; margin-left: auto; margin-right: auto; } .circle-pic{ width:50px; height:50px; -webkit-border-radius: 50%; border-radius: 50%; } 
 <div class="image"> </div> <p>or if you want only image try this</p> <img class="circle-pic" src="http://autokadabra.ru/system/uploads/users/18/18340/small.png?1318432918" /> 

In ionic 3, you can do this... 在离子3中,你可以这样做......

<ion-avatar>
      <img src="">
</ion-avatar>

That simple 那么简单

In some cases, you may need to set the img height and width to the same value manually. 在某些情况下,您可能需要手动将img高度和宽度设置为相同的值。 But this is the standard ionic 3 method. 但这是标准的离子3方法。

https://ionicframework.com/docs/components/#avatar-list https://ionicframework.com/docs/components/#avatar-list

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

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