如何在HTML中对多个按钮进行间距设置?

huangapple go评论67阅读模式
英文:

How do I space multiple buttons in HTML?

问题

Sure, here are the translated HTML code parts:

<a href="https://github.com/drippy-cat" class="button primary">GitHub</a>
<a href="https://discord.gg/xvTyBgn6F2" class="button primary">Discord</a>
<a href="https://app.daily.dev/drippy-cat" class="button primary">daily.dev</a>

Please let me know if you need any further assistance.

英文:
&lt;a href=&quot;https://github.com/drippy-cat&quot; class=&quot;button primary&quot;&gt;GitHub&lt;/a&gt;
&lt;a href=&quot;https://discord.gg/xvTyBgn6F2&quot; class=&quot;button primary&quot;&gt;Discord&lt;/a&gt;
&lt;a href=&quot;https://app.daily.dev/drippy-cat&quot; class=&quot;button primary&quot;&gt;daily.dev&lt;/a&gt;

I have been working on my website. This code is located in index.html of this repository. I have been trying to create under the "social" tab of the page. However, it ends up looking like the screenshot I attached. Is there a way to space out the buttons more and have them in a grid pattern? Thanks!

答案1

得分: 0

以下是翻译好的代码部分:

<div class="button-container">
  <a href="https://github.com/drippy-cat" class="button primary">GitHub</a>
  <a href="https://discord.gg/xvTyBgn6F2" class="button primary">Discord</a>
  <a href="https://app.daily.dev/drippy-cat" class="button primary">daily.dev</a>
</div>
<style>
  .button-container {
    display: flex;
  }

  .button-container a.button {
    margin-right: 15px;
  }
</style>
英文:

A quick solution is to add a wrapper and specify the margin of the buttons.

&lt;div class=&quot;button-container&quot;&gt;
  &lt;a href=&quot;https://github.com/drippy-cat&quot; class=&quot;button primary&quot;&gt;GitHub&lt;/a&gt;
  &lt;a href=&quot;https://discord.gg/xvTyBgn6F2&quot; class=&quot;button primary&quot;&gt;Discord&lt;/a&gt;
  &lt;a href=&quot;https://app.daily.dev/drippy-cat&quot; class=&quot;button primary&quot;&gt;daily.dev&lt;/a&gt;
&lt;/div&gt;
&lt;style&gt;
  .button-container {
    display: flex;
  }

  .button-container a.button {
    margin-right: 15px;
  }
&lt;/style&gt;

huangapple
  • 本文由 发表于 2023年5月18日 08:37:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76277028.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定