youtube订阅按钮内联

时间:2015-04-16 15:42:32

标签: html button youtube inline

我正在尝试将下面代码段中的按钮设为内联。我怎么能这样做?



<p style="clear:both;">
    <script src="https://apis.google.com/js/platform.js"></script>
    <h3>Subscribe to all our free videos </h3>
    <a Subscribe to all our free videos : class="g-ytsubscribe" data-channelid="UC1s3K1bQQDwvo3Qcaxg3Zjg" data-layout="full" style="display-inline" data-count="hidden"></a>
    <a class="button-big salmon rounded99" style="display-inline" "href="#" onclick="history.back();">Go Back a page</a>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

h3元素默认为100%宽度。使这个内联意味着它将占用所需的空间,并允许其他元素放在它旁边。

作为旁注,我不会在任何时候使用内联样式,因为它可能会导致特异性选择问题。

h3{
  display:inline-block;
  }
<p style="clear:both;">
<script src="https://apis.google.com/js/platform.js"></script>
<h3>Subscribe to all our free videos </h3>
<a Subscribe to all our free videos : class="g-ytsubscribe" data-channelid="UC1s3K1bQQDwvo3Qcaxg3Zjg" data-layout="full" style="display-inline" data-count="hidden"></a>
<a class="button-big salmon rounded99" style="display-inline" "href="#" onclick="history.back();">Go Back a page</a>

结果

enter image description here


您可能还需要在标记中添加vertical-align:top,以便链接正确对齐:

enter image description here

相关问题