html - 新的 Google Play 徽章尺寸不合适

标签 html

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

我相应地更改了我的代码

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

但是,它现在不再与 App Store 图标对齐。谷歌图标现在约为 37 像素,而 App Store 图标的高度与我设置的一样,为 45 像素。

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

为什么 Google 必须再次更改所有内容?另外,为什么它不能像以前那样工作?我真的需要把它放在 55 像素的高度才能让它看起来像 45 像素吗?对我来说,这听起来像是糟糕的代码。

编辑:忘记图片了 enter image description here

最佳答案

注意:自撰写此答案以来,图片已被 Google 更改,因此不再是复制/粘贴解决方案。

如果您使用正确的不带边框的源图像,使用正确的高度正确设置样式是微不足道的:

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>

关于html - 新的 Google Play 徽章尺寸不合适,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34941473/

相关文章:

firefox - HTML5 视频和降级?

javascript - 使用 JavaScript 进行登录表单验证安全吗?

html - 调整元素的位置

html - 有没有办法将样式强制为已经具有样式 =""属性的 div 元素

html - jQuery 等高的 div

html - 将特定边距应用到第一个和最后一个非兄弟元素

javascript - 单击数据关闭按钮时如何清除 Bootstrap 模式中的所有输入字段?

html - 如何重置 panzoom.js 的坐标?

html - 用 2px 高度渲染的 1px 高度的线

html - CSS Clearfix 不清除 header