简体   繁体   中英

Is it ok to exceed the number of columns of the parent column?

I have the following layout, using Twitter Bootstrap:

<div class="row">
    <div class="span8">
        <div class="row">
            <div class="span2"><img src="..."></div>
            <div class="span2"><img src="..."></div>
            <div class="span2"><img src="..."></div>
            <div class="span2"><img src="..."></div>
        </div>
    </div>

    <div class="span4">
        ...
    </div>
</div>

When I need to display more than 4 <img> , I can just create another row . But I've noticed that when I use more than 4 span2 inside the span8 , even without creating another row , it correctly splits them across several lines, rendering the same as if I had manually added the extra row s.

Is this a documented practice, or is it just working incidentally, and could have drawbacks in some situations / with some browsers?

It's OK and it's documented. Take a look at thumbnails section of the docs, you'll see an example of this practice.
By the way, if you are showing a collection of images you should be using thumbnails .

EDIT: Despite of everything, there's a known issue when doing this inside a row-fluid . So there's only support for static content right now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM