Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap 3 pull-right hangs on small windows

In my Twitter Bootstrap 3 project I have an alert div. It has button on left and send button on right. I add pull-right to send button. Everyting works for big screens. Right side button sits well in right. enter image description here

But In small windows, button hangs in the right side of the alert div, but overflows the div. How can I extend the alert div so the right button will be inside the div ? Or any other solution that suits this condition ?

enter image description here

http://jsfiddle.net/mavent/aaVMt/4/

 <div class="alert alert-success" id="ab1">
        <div id="ac1">
            <div class="btn-group">
                <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">
                    Text <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" role="menu">
                    <li><a href="#" onclick="">Text 1</a></li>
                    <li><a href="#" onclick="">Text 2</a></li>
                </ul>
            </div>

            <div style="display:inline-block;">
                <div id="a1">
                    <p>Some text some text this is my elegant text hello world this text is cool 1</p>
                </div>
            </div>

            <button class="btn btn-primary pull-right" id="aaa">
                Send
            </button>
        </div>
    </div>
like image 339
trante Avatar asked Dec 09 '25 19:12

trante


2 Answers

Try this:

<div class="alert alert-success" id="ab1">
     <div class="row">
         <div class="pull-left col-xs-6 col-sm-9 col-md-9">
             <div id="ac1">
                 <div class="btn-group">
                     <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">
                Text <span class="caret"></span>
                     </button>
                     <ul class="dropdown-menu" role="menu">
                         <li><a href="#" onclick="">Text 1</a></li>
                         <li><a href="#" onclick="">Text 2</a></li>
                     </ul>
                 </div>

               <div style="display:inline-block;">
                   <div id="a1">
                       <p>Some text some text this is my elegant text hello world this text is cool 1</p>
               </div>
        </div>            
         </div>
 <div class="col-xs-6 col-sm-3 col-md-3 pull-right">
        <button class="btn btn-primary" id="aaa">
            Send
        </button>
         </div>
        </div>
    </div>
</div>

http://jsfiddle.net/mavent/aaVMt/4/

like image 107
arturataide Avatar answered Dec 12 '25 11:12

arturataide


All you have to do is add class row to the div <div id="ac1" class='row'>.

Here is working example : http://jsfiddle.net/aaVMt/5/

What I did is :

Replaced <div id="ac1"> with <div id="ac1" class='row'>

like image 36
Rahul Patil Avatar answered Dec 12 '25 12:12

Rahul Patil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!