【问题标题】:Youtube Button HeightYoutube 按钮高度
【发布时间】:2018-08-26 04:12:57
【问题描述】:

我一直在尝试调整 YouTube 按钮的高度,使其与页面上其他社交媒体按钮的高度相匹配,但我似乎无法正常工作。看起来这应该相对容易。

这是网站:http://www.sunsetstudiosent.com,在索引页面的社交部分。

这是我目前正在运行的代码:

.nav--social__link.yt-button{
  height: 40px !important;
  overflow: visible;
  border-radius: 3px;
  width: 79px;
  margin-right: 4px;
}
.g-ytsubscribe{
  display: inline-block;
  vertical-align: middle !important;
  font-size: 1px;
  line-height: normal; font-size: 1px;
  text-indent: 0px; 
  padding: 0px; 
  background: transparent none repeat scroll 0% 0%; 
  border-style: none; 
}

【问题讨论】:

    标签: css button youtube height developer-tools


    【解决方案1】:

    您刚刚指定了<li> 的高度,但子元素的高度保持不变,iframe 中的样式也是如此。

    您可以实现这一点,尽管它相当复杂。您需要将以下 css 添加到您的代码中。

    li.nav--social__link.yt-button * {
        height: 40px !important;
    }
    

    然后,用js在iframe中插入另一行代码。

    .yt-uix-button.yt-uix-button-subscribe-branded {
        height: 28px !important;
    }
    

    【讨论】:

    • 写js有点超出我的能力。我可以剪切并粘贴到页面中,但仅此而已。应该提到的是,我在网站上输入的唯一代码是 YouTube 提供的代码。我相信 iframe 都是通过谷歌脚本生成的,而不是手动添加到网站的。没有严格的 CSS 修复?
    • 恐怕不行。您页面上的 CSS 无法设置 iframe 中的元素样式,如果您检查该元素,您可以看到来自 Youtube 的 css 文件将高度设置为 24px。但我不熟悉 youtube api。我认为应该有一种方法可以从那里编辑它。 @ThisGuy
    猜你喜欢
    • 1970-01-01
    • 2015-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-27
    • 2016-10-06
    • 2013-11-29
    相关资源
    最近更新 更多