【问题标题】:How can I add a margin-top to a button with Bootstrap and CSS如何使用 Bootstrap 和 CSS 向按钮添加边距顶部
【发布时间】:2016-02-12 22:41:07
【问题描述】:

我正在尝试向引导程序中的按钮添加边距顶部,但前提是它在 <form> 标记内并且只有当它有一个名为 formbutton 的类时,我该怎么做?我看了一遍,什么都没有。

我试过了

btn > form { 
    margin-top: 4px;
}

【问题讨论】:

  • 请向我们展示您的尝试...
  • btn > 我试过的表格
  • 表示:“选择一个表单元素,它是 btn 元素的直接后代”

标签: html css twitter-bootstrap


【解决方案1】:
form .formbutton {
    margin-top:4px;
}

https://jsfiddle.net/mxdcobjL/1/

【讨论】:

    【解决方案2】:

    只需创建您自己的 CSS 文件并在加载其他 CSS 文件后将其加载到您的 HTML 文档中,或者在您的文档中放置一个包含此内容的样式部分:

    form > button .formbutton{
      margin-top: ...
    }
    

    【讨论】:

      【解决方案3】:

      这样就可以了

      form .formbutton { 
          margin-top: 4px;
      }
      

      【讨论】:

        猜你喜欢
        • 2019-01-20
        • 1970-01-01
        • 1970-01-01
        • 2018-12-03
        • 2013-06-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多