<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&channelid=UCt7Qb8JdtlG_pO1Pr4w2jrQ&layout=default&count=default&origin=http%3A%2F%2Feverydayrelay.com&gsrc=3p&ic=1&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&id=I0_1459495947902&parent=http%3A%2F%2Feverydayrelay.com&pfname=&rpctoken=13548707" data-gapiattached="true"></iframe></div>
我希望垂直线的值是 bottom
,而不是 baseline
,如上所示
既然它已生成,我该如何指定它?
最佳答案
不幸的是,您提供的代码创建了一个iframe
,引用了您自己的不同域。
这意味着你无法修改它自带的CSS。
您可以在此处阅读有关同源策略的更多信息 - https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
如果 iframe
来自与您的页面托管相同的域,您将能够通过 JS 更改 CSS - More information here
旁注 - 如果您尝试更改它的定位,可能值得尝试将小部件包装在您自己的 div
中,并将 CSS 应用于该 div
.
关于html - Youtube 订阅按钮垂直对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36350591/