简体   繁体   English

尝试制作圆形图像

[英]Trying to make a circle image

This question has been asked many times before but I still can't seem to figure such a simple problem out. 这个问题之前已经被问过很多次了,但是我似乎仍然无法弄清楚这样一个简单的问题。

I'm trying to take an image and make it into a circle but when I try to do this: 我正在尝试拍摄图像并将其圈成圆圈,但是当我尝试这样做时:

const styles = {
  profileImage: {
    padding: "5% 0",
    objectFit: "cover",
    display: "block",
    width: "10vh",
    height: "10vh",
    borderRadius: "50%",
    border: "1px solid white", 
    margin: "0 auto"
  }
}

My image still comes out looking like this: 我的图像仍然看起来像这样: 在此处输入图片说明

The white border is what I'd like the dimensions to be but the actual photo gets cropped off for some reason. 白色边框是我想要的尺寸,但是由于某种原因,实际照片被裁剪掉了。 I would appreciate any pointers! 我将不胜感激! Been pulling my hair out for this :-( 为此拉我的头发:-(

Thanks! 谢谢!

I think it is due to this line: 我认为这是由于以下原因:

padding: "5% 0",

Try removing that line 尝试删除该行

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

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