【问题标题】:Youtube subcribe button vertical alignYoutube 订阅按钮垂直对齐
【发布时间】:2016-07-20 22:07:02
【问题描述】:
<script src="https://apis.google.com/js/platform.js"></script>

<div class="g-ytsubscribe" data-channelid="UCt7Qb8JdtlG_pO1Pr4w2jrQ" data-layout="default" data-count="default"></div>

我正在检查网站上生成的上述代码,我看到了:

<div id="___ytsubscribe_0" style="text-indent: 0px; margin: 0px; padding: 0px; border-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline; display: inline-block; width: 104px; height: 24px; background: transparent;"><iframe frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="position: static; top: 0px; width: 104px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 24px;" tabindex="0" vspace="0" width="100%" id="I0_1459495947902" name="I0_1459495947902" src="https://www.youtube.com/subscribe_embed?usegapi=1&amp;channelid=UCt7Qb8JdtlG_pO1Pr4w2jrQ&amp;layout=default&amp;count=default&amp;origin=http%3A%2F%2Feverydayrelay.com&amp;gsrc=3p&amp;ic=1&amp;jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.O7qc2VuIvpU.O%2Fm%3D__features__%2Fam%3DEQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCPZ7Tpph6RiCDsul5sXKhzE5OYMaQ#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Conload&amp;id=I0_1459495947902&amp;parent=http%3A%2F%2Feverydayrelay.com&amp;pfname=&amp;rpctoken=13548707" data-gapiattached="true"></iframe></div>

我希望vertical-aline 的值为bottom,而不是baseline,如上所示

生成后如何指定?

【问题讨论】:

    标签: html css youtube youtube-api youtube-data-api


    【解决方案1】:

    不幸的是,您提供的代码创建了一个iframe,引用了您自己的不同域

    这意味着您无法修改它附带的 CSS。

    您可以在此处阅读有关同源政策的更多信息 - https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy

    如果iframe 来自您的页面所在的同一个域,您将能够通过 JS 更改 CSS - More information here

    旁注 - 如果您尝试更改其定位,则可能值得尝试将小部件包装在您自己的 div 中,并将 CSS 应用于该 div p>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-23
      • 2013-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多