Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to divide a web in 2 columns using bootstrap?

I want to divide a web page made with JSF in two columns, but I'm having problems as it's not displayed as I want. I'll show you what I have.

<h:panelGrid id="panelPpal" columns="2" style="width: 100%">
                <h:panelGrid style="width: 100%">
                    <h:form id="projectForm" class="form-horizontal">
                        <div class="form-group">
                            <h:outputLabel id="lblProjectName" 
                                           value="#{rDisenyo['seccion.crea.nombre']}"
                                           for="projectName"
                                           class="col-md-3 control-label"/>
                            <div class="col-md-6">
                                <h:inputText id="projectName" label="Nombre"
                                             value="#{newProjectBacking.nombreProyecto}"
                                             class="form-control"/>
                            </div>

                        </div>

                        <div class="form-group">
                            <h:outputLabel for="grosorCristal" value="#{rDisenyo['dialog.avanzadas.grosorCristal']}"
                                           class="col-md-3 control-label"/>
                            <div class="col-md-6">
                                <h:selectOneMenu id="grosorCristal" 
                                                 class="form-control"
                                                 label="Grosor del Cristal"
                                                 value="#{newProjectBacking.grosorCristal}"
                                                 required="true" >
                                    <f:selectItem itemLabel="----------" itemValue="0"/>
                                    <f:selectItem itemLabel="8 #{rDisenyo['grosor.cristal.milimetro']}" itemValue="8"/>
                                    <f:selectItem itemLabel="10 #{rDisenyo['grosor.cristal.milimetro']}" itemValue="10"/>
                                    <f:selectItem itemLabel="12 #{rDisenyo['grosor.cristal.milimetro']}" itemValue="12"/>

                                </h:selectOneMenu>
                            </div>

                        </div>

                        <div class="form-group">
                            <h:outputLabel for="ralMenu" id="ralLbl"
                                           value="#{rDisenyo['proyecto.opcionesprevias.ral']}"
                                           class="col-md-3 control-label"/>
                            <div class="col-md-6">
                                <h:selectOneMenu id="ralMenu" class="form-control" 
                                                 value="#{newProjectBacking.ral}"
                                                 >
                                    <f:selectItem itemLabel="" itemValue="0"/>
                                    <f:selectItem itemLabel="#{rDisenyo['proyecto.opcionesprevias.ral.blanco']}" itemValue="1"/>
                                    <f:selectItem itemLabel="#{rDisenyo['proyecto.opcionesprevias.ral.crudo']}" itemValue="2"/>
                                    <f:selectItem itemLabel="#{rDisenyo['proyecto.opcionesprevias.ral.anodizado']}" itemValue="3"/>
                                </h:selectOneMenu>
                            </div>

                        </div>

                    </h:form>
                </h:panelGrid>

                <h:panelGrid style="width: 100%">
                    <div class="col-md-8">
                        <div class="panel panel-primary">
                            <div class="panel-heading">
                                <h3 class="panel-title">#{rDisenyo['instrucciones.title']}</h3>
                            </div>
                            <div class="panel-body">
                                <div class="subtitulo-instruciones">
                                    #{rDisenyo['instrucciones.angulos.grados']}
                                </div>

                                #{rDisenyo['instrucciones.angulos.linea1']}<br/>
                                #{rDisenyo['instrucciones.angulos.linea2']}<br/>
                                <div class="subtitulo-instruciones">
                                    #{rDisenyo['instrucciones.longitud.title']}
                                </div>

                                #{rDisenyo['instrucciones.longitud.linea1']}<br/>
                                <div class="subtitulo-instruciones">
                                    #{rDisenyo['instrucciones.altura.title']}
                                </div>

                                #{rDisenyo['instrucciones.altura.linea1']}<br/>
                                <div class="subtitulo-instruciones">
                                    #{rDisenyo['instrucciones.recogenizq.title']}
                                </div>

                                #{rDisenyo['instrucciones.recogenizq.linea1']}<br/>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-8">
                    Eliga el tipo de proyecto:
                    <h:selectOneRadio id="tipoProyectoRadioButton" value="#{newProjectBacking.tipoProyecto}">
                        <div class="radio">
                            <f:selectItem itemValue="1" itemLabel="Proyecto A" />
                        </div>
                        <div class="radio">
                            <f:selectItem itemValue="2" itemLabel="Proyecto B" />
                        </div>
                        <div class="radio">
                            <f:selectItem itemValue="3" itemLabel="Proyecto C" />
                        </div>     
                    </h:selectOneRadio>
                    </div>
                </h:panelGrid>


            </h:panelGrid>

As you can see, there are two parts in my app: the left one is a form and the right one has instructions and a different form (I know that it isn't yet inside a h:form). I want the right panel to start in the center of the window, but I don't know how to do it. Thank you!

enter image description here

like image 891
Naster Avatar asked Jul 23 '15 10:07

Naster


People also ask

How do I split a website into sections in Bootstrap?

In Bootstrap 4, there is an easy way to create equal width columns for all devices: just remove the number from . col-lg-* and only use the . col-lg class on a specified number of col elements. Bootstrap will recognize how many columns there are, and each column will get the same width.

How do I split a row into two columns in Bootstrap?

You can use col-md-* class for child element inside the parent row class to split the columns for your need.

How do I split a row into 5 columns in Bootstrap?

You can use the row-cols-* (eg: row-cols-3 , row-cols-md-3 ) class for your requirement. Show activity on this post. You can use bootstrap-4 default 'col' property to solve this issue. This will auto divide the given space into 5 equal parts.


Video Answer


1 Answers

I've found a solution here: How to divide a Twitter bootstrap modal into 2 parts

<div class="modal-body row">
  <div class="col-md-6">
    <!-- Your first column here -->
  </div>
  <div class="col-md-6">
    <!-- Your second column here -->
  </div>
</div>
like image 98
Naster Avatar answered Sep 28 '22 05:09

Naster