Mohammad Areeb Siddiqui
Mohammad Areeb Siddiqui

Reputation: 10179

Modal behaving abnormally

I am trying to build a two column layout in a bootstrap modal. This is the code:

<div class="modal fade in" id="product-showcase-modal" tabindex="-1" role="dialog" aria-labelledby="product-showcase" aria-hidden="false" style="display: block;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <div class="container col-xs-12">
                    <div class="row-fluid">
                        <div class="col-xs-6">
                            <img src="http://localhost/haya/img/hijabs/dark%20grey.jpg" id="product_image" width="200px" height="auto" style="display: inline;">
                        </div>
                        <div class="col-xs-6">
                             <h3 id="product_name">Dark Gray</h3>

                            <p id="new_price">$3.00</p>
                            <p style="text-decoration: line-through;" id="old_price">$4.35</p>
                            <button class="btn btn-warning">Add to cart</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>

And this is the result: enter image description here

I have no idea why is this happening. Can anyone resolve this?

UPDATE 1: I removed the col-xs-12 class from the container div. Now the container is in the modal's body but it's has taken a width of 100% (my screen's width). Result: enter image description here

Upvotes: 0

Views: 429

Answers (1)

KnowHowSolutions
KnowHowSolutions

Reputation: 680

Just need to add a clearfix to the modal-body. This will fix the float item issue where the container doesn't fully expand.

Fiddle: http://jsfiddle.net/52VtD/6310/

<div class="modal-body clearfix">

Upvotes: 1

Related Questions