图像固有尺寸与给定尺寸的CSS不同

时间:2020-08-05 15:12:21

标签: html css

我正在尝试在我创建的自定义注册按钮上插入Facebook徽标。我根据下面的代码将图片的尺寸设置为50x50

img{
    /*here*/
    width:50px;
    height:50px;
    margin-right: 20px;
    background-color: white;
    color:blue;
  }

它有效地将按钮上的图像尺寸设置为50x50,但是图像的固有尺寸为1x1(即width:1px; height:1px),我不明白为什么这样做。见下文

enter image description here enter image description here

请帮助我

2 个答案:

答案 0 :(得分:0)

不确定100%,但是尝试将其添加到您的img元素中。

<img intrinsicsize="50 x 50">

还请阅读this文章

答案 1 :(得分:0)

我发现问题出在图像的路径上,谢谢您的帮助