How to place button in top Right corner using bootstrap?

To place a button in the top right, there are several ways to do this.

  1. The easiest way to do this, Set “pull-right” in button class.
    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html lang="en">
      
    <head>
        <title>
          place button in top right corner
      </title>
      
        <meta charset="utf-8">
        <meta name="viewport" 
              content="width=device-width, 
                       initial-scale=1">
        <link rel="stylesheet"
              href=
        
        <script src=
      </script>
        
        <script src=
      </script>
    </head>
      
    <body>
        <div class="container">
            <h1>
          <span style="color:green">GeeksforGeek</span>
          <button class='btn btn-success pull-right'>
            Button Text
              </button>
        </h1>
        </div>
    </body>
      
    </html>

    chevron_right

    
    

    Output:

  2. The button group is used for more than one button like in this example.
    The button group is optional if you’re only using a single button.
    Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html lang="en">
      
    <head>
        <title>
            place button in top right corner
        </title>
      
        <meta charset="utf-8">
        <meta name="viewport" 
              content="width=device-width, 
                       initial-scale=1">
        <link rel="stylesheet" 
              href=
      
        <script src=
        </script>
      
        <script src=
        </script>
    </head>
      
    <body>
      
        <div class="container">
            <section>
                <div class="page-header">
                    <h3 style="color:green"
                        class="pull-left">
            GeeksforGeeks
          </h3>
                    <div class="pull-right">
                        <div class="btn-group">
                            <button class="btn btn-success">
                                Languages
                            </button>
                            <button class="btn btn-success dropdown-toggle" 
                                    data-toggle="dropdown">
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu pull-right">
                                <li>
                                    <a href="#">DS</a>
                                </li>
                                <li>
                                    <a href="#">Python</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
                Other Content
            </section>
        </div>
    </body>
      
    </html>

    chevron_right

    
    



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.