WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Bootstrap 4 - Button Group


Button agencies permit multiple buttons to be stacked collectively on a single line.

Basic Button Group

You can create the number one button group thru the use of .Btn-enterprise class internal <div> detail as proven within the underneath instance −

Example

<html lang = "en">
    <head>
        <!-- Meta tags -->
        <meta charset = "utf-8">
        <meta call = "viewport" content cloth material = "width = tool-width, initial-scale = 1, reduce once more-to-in shape = no">

        <!-- Bootstrap CSS -->
        <link rel = "stylesheet"
            href = "https://stackpath.Bootstrapcdn.Com/bootstrap/four.1.Three/css/bootstrap.Min.Css"
            integrity = "sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
            crossorigin = "anonymous">

        <discover>Bootstrap four Example</call>
    </head>

    <body>
        <div splendor = "discipline">
            <h2>Button Group</h2>
            <div elegance = "btn-business organization">
                <button type = "button" splendor = "btn btn-information">Google</button>
                <button kind = "button" beauty = "btn btn-records">Yahoo</button>
                <button type = "button" elegance = "btn btn-statistics">Facebook</button>
            </div>
        </div>

        <!-- jQuery first, then Popper.Js, then Bootstrap JS -->
        <script src = "https://code.Jquery.Com/jquery-three.Three.1.Narrow.Min.Js"
            integrity = "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
            crossorigin = "nameless">
        </script>

        <script src = "https://cdnjs.Cloudflare.Com/ajax/libs/popper.Js/1.14.Three/umd/popper.Min.Js"
            integrity = "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
            crossorigin = "nameless">
        </script>

        <script src = "https://stackpath.Bootstrapcdn.Com/bootstrap/four.1.Three/js/bootstrap.Min.Js"
            integrity = "sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
            crossorigin = "anonymous">
        </script>

    </frame>
</html>

It will produce the following end end result −

Output

Button Toolbar

You can organisation devices of button agency proper right right into a single toolbar via the use of .Btn-toolbar elegance as proven in the example below −

Example

<html lang = "en">
    <head>
        <!-- Meta tags -->
        <meta charset = "utf-8">
        <meta call = "viewport" content material = "width = tool-width, initial-scale = 1, shrink-to-in shape = no">

        <!-- Bootstrap CSS -->
        <hyperlink rel = "stylesheet"
            href = "https://stackpath.Bootstrapcdn.Com/bootstrap/four.1.3/css/bootstrap.Min.Css"
            integrity = "sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
            crossorigin = "nameless">

        <understand>Bootstrap 4 Example</perceive>
    </head>

    <body>
        <div class = "field">
            <h2>Button Toolbar</h2>
            <div elegance = "btn-toolbar" position = "toolbar" aria-label = "Toolbar with button businesses">
                <div elegance = "btn-employer mr-2" function = "organization" aria-label = "First employer">
                    <button kind = "button" splendor =" btn btn-info">Google.Com</button>
                    <button type = "button" elegance = "btn btn-data">Youtube.Com</button>
                    <button kind = "button" elegance = "btn btn-records">Facebook.Com</button>
                    <button type = "button" elegance = "btn btn-information">Baidu.Com</button>
                </div>

                <div elegance = "btn-business enterprise mr-2" function = "group" aria-label = "Second organization">
                    <button type = "button" beauty = "btn btn-facts">Wikipedia.Org</button>
                    <button kind = "button" beauty = "btn btn-information">Qq.Com

</button>
                    <button kind = "button" magnificence = "btn btn-information">Taobao.Com

</button>
                </div>

                <div elegance = "btn-organization mr-2" feature = "organization" aria-label = "Third agency">
                    <button type = "button" class = "btn btn-statistics">Tmall.Com</buttongt;
                    <button kind = "button" class = "btn btn-records">Yahoo.Com</buttongt;
                </div>
            </div>
        </div>

        <!-- jQuery first, then Popper.Js, then Bootstrap JS -->
        <script src = "https://code.Jquery.Com/jquery-3.Three.1.Narrow.Min.Js"
            integrity = "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
            crossorigin = "anonymous">
        </script>

        <script src = "https://cdnjs.Cloudflare.Com/ajax/libs/popper.Js/1.14.Three/umd/popper.Min.Js"
            integrity = "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
            crossorigin = "nameless">
        </script>

        <script src = "https://stackpath.Bootstrapcdn.Com/bootstrap/four.1.Three/js/bootstrap.Min.Js"
            integrity = "sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
            crossorigin = "nameless">
        </script>

    </body>
</html>

It will produce the subsequent give up result −

Output

Button Group Sizes

You can manipulate duration of the button enterprise by which consist of .Btn-institution-sm or .Btn-group-lg magnificence to the .Button-company beauty as proven in the under instance −

<html lang = "en">
    <head>
        <!-- Meta tags -->
        <meta charset = "utf-8">
        <meta call = "viewport" content material material = "width = device-width, initial-scale = 1, decrease-to-in form = no">

        <!-- Bootstrap CSS -->
        <link rel = "stylesheet"
            href = "https://stackpath.Bootstrapcdn.Com/bootstrap/four.1.Three/css/bootstrap.Min.Css"
            integrity = "sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
            crossorigin = "nameless">

        <pick out>Bootstrap four Example</name>
    </head>

    <body>
        <div class = "concern">
            <h2>Button Group Sizes</h2>
            <div class = "btn-group btn-agency-lg" function = "agency">
                <button type = "button" beauty = "btn btn-statistics">Google</button>
                <button type = "button" beauty = "btn btn-records">Yahoo</button>
                <button kind = "button" elegance = "btn btn-records">Facebook</button>
            </div>
            <br>
            <br>

            <div elegance = "btn-group" feature = "organization">
                <button kind = "button" beauty = "btn btn-records">Google</button>
                <button kind = "button" elegance = "btn btn-information">Yahoo</button>
                <button kind = "button" magnificence = "btn btn-records">Facebook</button>
            </div>
            <br>
            <br>

            <div elegance = "btn-employer btn-organization-sm" characteristic = "institution">
                <button kind = "button" magnificence = "btn btn-statistics">Google</button>
                <button kind = "button" elegance = "btn btn-data">Football</button>
                <button type = "button" class = "btn btn-info">Hockey</button>
            </div>
        </div>

        <!-- jQuery first, then Popper.Js, then Bootstrap JS -->
        <script src = "https://code.Jquery.Com/jquery-three.Three.1.Narrow.Min.Js"
            integrity = "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
            crossorigin = "nameless">
        </script>

        <script src = "https://cdnjs.Cloudflare.Com/ajax/libs/popper.Js/1.14.Three/umd/popper.Min.Js"
            integrity = "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
            crossorigin = "nameless">
        </script>

        <script src = "https://stackpath.Bootstrapcdn.Com/bootstrap/4.1.Three/js/bootstrap.Min.Js"
            integrity = "sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
            crossorigin = "anonymous">
        </script>

    </frame>
</html>

It will produce the following stop end result −

Output

Vertical Button Group

You can show the button institution vertically with the aid of using the beauty .Btn-organization-vertical as showed in the example underneath −

<html lang = "en">
    <head>
        <!-- Meta tags -->
        <meta charset = "utf-8">
        <meta name = "viewport" content material = "width = tool-width, initial-scale = 1, decrease-to-healthful = no">

        <!-- Bootstrap CSS -->
        <hyperlink rel = "stylesheet"
            href = "https://stackpath.Bootstrapcdn.Com/bootstrap/four.1.Three/css/bootstrap.Min.Css"
            integrity = "sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
            crossorigin = "anonymous">

        <come to be privy to>Bootstrap four Example</pick out>
    </head>

    <body>
        <div magnificence = "field">
            <h2>Vertical Button Group</h2>
            <div magnificence = "btn-group-vertical" feature = "group">
                <button kind = "button" beauty = "btn btn-statistics">Google</button>
                <button type = "button" class = "btn btn-statistics">Yahoo</button>
                <button type = "button" elegance = "btn btn-statistics">Facebook</button>
            </div>
        </div>

        <!-- jQuery first, then Popper.Js, then Bootstrap JS -->
        <script src = "https://code.Jquery.Com/jquery-three.Three.1.Slender.Min.Js"
            integrity = "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
            crossorigin = "nameless">
        </script>

        <script src = "https://cdnjs.Cloudflare.Com/ajax/libs/popper.Js/1.14.Three/umd/popper.Min.Js"
            integrity = "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
            crossorigin = "anonymous">
        </script>

        <script src = "https://stackpath.Bootstrapcdn.Com/bootstrap/4.1.Three/js/bootstrap.Min.Js"
            integrity = "sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
            crossorigin = "anonymous">
        </script>

    </body>
</html>

It will produce the following end end end result −

Output