zoukankan      html  css  js  c++  java
  • Bootstrap 关于按钮组

    当为 .btn-group 中的元素应用工具提示或弹出框时,必须指定 container: 'body' 选项,这样可以避免不必要的副作用(例如工具提示或弹出框触发时,会让页面元素变宽和/或失去圆角)?

    对于按钮组合,应该是 role="group",对于toolbar(工具栏)应该是 role="toolbar"

    按钮组和工具栏应给定一个明确的label标签,尽管设置了正确的 role 属性,我们使用 aria-label,但是, aria-labelledby 也可以使用。

    <div class="btn-group" role="group" aria-label="...">
      <button type="button" class="btn btn-default">Left</button>
      <button type="button" class="btn btn-default">Middle</button>
      <button type="button" class="btn btn-default">Right</button>
    </div>
    

      

    竖直的话是

    class="btn-group-vertical"
      <div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
            <div class="btn-group" role="group" aria-label="First group">
                <button type="button" class="btn btn-default">1</button>
                <button type="button" class="btn btn-default">2</button>
                <button type="button" class="btn btn-default">3</button>
                <button type="button" class="btn btn-default">4</button>
            </div>
        </div>
    

      

    也可以加尺寸

    只要给 .btn-group 加上 .btn-group-lg,sm,xs等即可。

    想要把下拉菜单混合到一系列按钮中,只须把 .btn-group 放入大 .btn-group 中就可以,嵌套。

    关于 <a> 元素

    只须将一系列 .btn 元素包裹到 .btn-group.btn-group-justified 中即可。

    <div class="btn-group btn-group-justified" role="group" aria-label="Justified button group">
          <a href="#" class="btn btn-default" role="button">Left</a>
          <a href="#" class="btn btn-default" role="button">Middle</a>
          <a href="#" class="btn btn-default" role="button">Right</a>
        </div>
    

      

    关于 <button> 元素

    为了将 <button> 元素用于两端对齐的按钮组中,必须将每个按钮包裹进一个按钮组中。

    <div class="btn-group btn-group-justified" role="group" aria-label="...">
    <div class="btn-group" role="group">
    <button type="button" class="btn btn-default">Left</button>
    </div>
    <div class="btn-group" role="group">
    <button type="button" class="btn btn-default">Middle</button>
    </div>
    <div class="btn-group" role="group">
    <button type="button" class="btn btn-default">Right</button>
    </div>
    </div>
    

      看起来a更方便?

  • 相关阅读:
    最新iOS发布App Store详细图文教程~
    介绍一个轻量级iOS安全框架:SSKeyChain
    今天科普一下 苹果开发者账号中:个人、公司、企业账号的区别
    iOS开发:Framework的创建
    JMS 在 SpringBoot 中的使用
    iOS 引入外部字体 otf/ttf/ttc
    公司企业苹果开发者账号中个人、公司企业账号的不同
    Git版本管理
    有关苹果手机下载应用后提示不受信任的企业开发者解决方案:
    尝试一下markdown
  • 原文地址:https://www.cnblogs.com/xxml/p/5620453.html
Copyright © 2011-2022 走看看