【问题标题】:How do I put a border around some button text without also putting it around the div's left-hand padding?如何在一些按钮文本周围放置边框而不将其放在 div 的左侧填充周围?
【发布时间】:2017-10-06 20:09:24
【问题描述】:

如何在一些按钮文本周围放置边框,而不将其放置在 div 的左侧填充周围?我宁愿不使用 JS、Flexbox 或 CSS3。

这是我目前得到的:

    .button-1 {
    padding: 0 0 0 20px;
    text-align: center;
    border: 1px solid #000;
    border-radius: 7px;
    display: inline;
    margin: -5px auto 0 auto;}

    
<a href="#1" class="button-1">hello</a><a href="#1" class="button-1">cheerio</a>

【问题讨论】:

  • margin 代替 padding 怎么样?
  • 你是对的 - 谢谢!你知道,我试过了,因为它使边框太靠近我认为“这不可能”的文本,所以没有意识到可以使用padding 控制到边框的距离。当你累了,这就是编码的结果。再次感谢。

标签: html css button


【解决方案1】:

你在为此努力吗

<button><span style="border:1px solid; padding 10px; margin-left:10px">Border Around Text</span></button>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-30
    • 1970-01-01
    • 1970-01-01
    • 2016-09-19
    相关资源
    最近更新 更多