【问题标题】:Is there any way to make a border with a spacing between the border and the text?有没有办法在边框和文本之间制作一个有间距的边框?
【发布时间】:2018-12-28 15:06:00
【问题描述】:

我尝试了很多东西,但都没有奏效,我需要帮助,因为我想制作一个 hire me 按钮,但我可以制作一个在文本和边框之间指定分隔的边框。

我有一张图片可以在这里展示我想要的东西:

HTML 代码:

<a class="hireme" href="#contact">HIRE ME</a>

【问题讨论】:

    标签: html css button padding


    【解决方案1】:

    这是一个起点:

    .hireme {
      text-decoration: none;
      padding: 1ex;
      border: thin solid gray;
      border-radius: 1em;
      text-transform: uppercase;
      color: black;
    }
    &lt;a class="hireme" href="#contact"&gt;Hire Me&lt;/a&gt;

    在这个:

    • text-decoration 去掉了链接的默认下划线
    • padding 在文本和边框之间放置间距
    • border 添加你想要的边框——如果太暗,试试#ccc 而不是灰色,或者网络上有 CSS 颜色选择器
    • border-radius 使边框变圆
    • text-transform 使文本以大写形式呈现
    • color 覆盖颜色,链接通常默认为蓝色

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-16
      • 1970-01-01
      • 2019-04-21
      • 2023-03-11
      • 2019-05-20
      • 1970-01-01
      相关资源
      最近更新 更多