简体   繁体   中英

How to align dynamically generated div's

I want to align my divs in two rows.

     <div class="row-fluid">        
     <?php

        foreach($role_array as $k =>$v)
        {
            if($k != "bookin_operator" && $k!= "production_manager" && $k != "client" && $k != "admin" )
            {

        ?>


                <div class="span6">  
                    <div class='control-group'>
                        <label for='<?php echo $k;  ?>' class='control-label'><?php  echo $v ;?></label>
                        <div class='controls'>
                            <select class='form-control' name='<?php echo $k;  ?>[]' id='<?php echo $k;  ?>' multiple='multiple' size='5'>
                                <?php

                                   foreach($all_datas[$k] as $datas ) 
                                   {

                                        $username = "{$datas->nickname}";

                                        echo "<option value='{$datas->id}'>{$username}</option>";
                                   }

                                ?>

                            </select>
                            <label for="<?php echo $k;  ?>" class="error" style="display:none"></label>
                        </div>
                    </div>                         
                </div> 

        <?php
            }

        } 

        ?> 
        </div>   

I want to 11 similar divs(class="span6"),now the divs displayed like 1st and second in single row bt remaining are in different rows. I want to display it 2 in a row.how it possible??

You can use Bootstrap or an equivalent system of grid.

If you want it pure, try this :

.span6 {
    width: 49%;
    display: inline-block;
}

Example with JSFiddle

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