Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap fluid grid: input breaks out of its container in ie7

Why in IE7 input breaks out of its container?

http://jsfiddle.net/Q8jPM/2/

enter image description here

<div class="row-fluid" style="margin-top:10px;">
    <div class="span12">
        <div class="row-fluid">
            <div class="span6">
                <div class="row-fluid">
                    <div class="span6 " style="background:green;">
                        <input type="text" class="span12">
                    </div>
                    <div class="span6" style="background:blue;">
                        <input type="text" class="span12">
                    </div>
                </div>
            </div>
            <div class="span6">
                <div class="row-fluid">
                    <div class="span6" style="background:green;">
                        <input type="text" class="span12">
                    </div>
                    <div class="span6" style="background:blue;">
                        <input type="text" class="span12">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

UPDATE: I suppose it's box-model and width issue, but is any solution with bootstrap?

like image 396
johnny Avatar asked Oct 10 '12 09:10

johnny


People also ask

How many tiers does Bootstrap 5 grid system includes for building complex responsive layouts?

Bootstrap's grid includes five tiers of predefined classes for building complex responsive layouts.

Does Bootstrap need a container in row?

Short answer: you do need to use container , but you don't need to use row . You can put elements directly in the container or container-fluid .

What is fluid grid in Bootstrap?

container-fluid simply applies the width: 100% instead of different width for different viewport sizes. However, the layout will still responsive and you can use the grid classes as usual. See the tutorial on Bootstrap grid system to learn more about grid classes.

How do I customize Bootstrap grid?

Just check the Grid System block on the Customize page. The @grid-columns field allows to set a different number of columns, and the @grid-gutter-width field lets you change the gutter width. Customizers are convenient when bootstrap. css is the only file you need and when you don't work with preprocessors.


1 Answers

this happens because IE7 does not support the css property

box-sizing: border-box;

that considers padding and border size as part of the elements width.

read more about this property here: http://paulirish.com/2012/box-sizing-border-box-ftw/

because of this, IE7 adds the padding and border size to the input width - exceeding the parent width. You will have to set those to 0 in order to get the element fit to the parent size and stay fluid.

you could try adding a wrapper element around the input and then setting the padding and border to the wrapper. This will work in all browsers

like image 102
Luca Avatar answered Nov 15 '22 04:11

Luca