新Google Play徽章没有正确尺寸

问题描述:

今天我意识到旧版链接“获取Google Play上的徽章”(https://developer.android.com/images/brand/en_generic_rgb_wo_45.png)不再有效(Android开发者更新您的网站!),而我检查新版本在这里:https://play.google.com/intl/en_us/badges/新Google Play徽章没有正确尺寸

我适时改变我的代码

. . . src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge-border.png" height="45" /> 

然而,现在不与App Store图标更多排队。 google图标现在约为37px,而App Store图标就像我设置的那样,高度为45px。

看起来像白色边框周围的填充是“硬编码”到图片中。检查我附上的图片的尺寸。

为什么Google必须再次改变一切?另外,为什么它不能像以前那样工作?我真的需要把它放在55像素的高度,才能使它看起来像 45px?这对我来说听起来很糟糕。

编辑:忘了图片 enter image description here

+0

你产生边框设置为无的徽章?或者包含边框? – Christophvh

+0

由于App Store徽章中包含边框也有白色边框,因此我希望徽章看起来类似 – user2875404

+0

这就是您的问题,请在没有包含边框的情况下生成徽章并重试。边界为它提供了你不想要的额外空间。 – Christophvh

如果你使用了正确的源图像无边框包括它的琐碎与正确的高度正确样式是:

body { 
 
    background:black; 
 
} 
 
img { 
 
    border:1px solid white; 
 
    border-radius:6px; 
 
    box-sizing:border-box; 
 
    height:45px; 
 
} 
 
span { 
 
    background:#888; 
 
    display:inline-block; 
 
    height:45px; 
 
    vertical-align:top; 
 
}
<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png"> 
 
<span>Reference block of 45px high</span>

+2

非常感谢答案的人,但是没有说在某个地方你不能更改徽章的外观?或者这只适用于徽章内的编辑? – user2875404

+0

你不允许扭曲或修改它。手动添加已经存在的边框不是“失真”。 –

+0

干杯兄弟,标记为答案! – user2875404