Row spanning in Bootstrap Grid design - html

I am using the Grid layout in Bootstrap.
How do I make a particular control(say text area) span for 3 rows in this grid design?
Is it possible with Grid layout?

You essentially want to use a nested grid or a form group.
First, split the page into two columns, the left with more than one row and the right with only one row. In the provided example, I demonstrate how you could use a form group in the left column to get the labels/inputs exactly as in your diagram.
<div class="row">
<!-- Left Column -->
<div class="col-sm-6">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-sm-3 control-label">Input 1</label>
<div class="col-sm-9">
<input type="text" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Input 2</label>
<div class="col-sm-9">
<input type="text" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Input 3</label>
<div class="col-sm-9">
<input type="text" class="form-control">
</div>
</div>
</form>
</div>
<!-- Right Column -->
<div class="col-sm-6">
<textarea class="form-control" rows="3"></textarea>
</div>
</div>
See this working Plnkr example
Note that the plnkr needs to be wide enough to not apply the responsive layout and stack
If instead you wanted to use a nested grid to get the same effect, you would just define a new grid with rows/columns inside the left column.

I did not test this, but try something like this:
<div class="row">
<div class="col-md-9">
<div class="col-md-12">.col-md-12</div>
<div class="col-md-12">.col-md-12</div>
<div class="col-md-12">.col-md-12</div>
</div>
<div class="col-md-3">.col-md-3</div>
</div>
This uses the nested columns, like #user3711852 suggested.

Related

Textbox doesn't appear as it is supposed to be using bootstrap v4

I am using Bootstrap v4.0.0-alpha.6. The textbox that is supposed to look like the this doesn't appear the same when I tried to place one in my login form. This is how it looks like in chrome. Refer the code below:
<div class="container">
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-9">
<form>
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="inputEmail3" placeholder="Email">
</div>
</div>
</form>
</div>
</div>
</div>
Also there is another issue, the above code is supposed to place the label and textbox on same line but the textbox is placed below the label. I can't find any solution for this on the web.

Bootstrap 3 making nested rows

When making nested columns with bootstrap in asp.net using webforms, how would you span the entire child?
Example:
<div class="row">
<div class="col-md-3">
<div class="row">Stuff</div>
</div>
<div class="col-md-9">
<div class="row">
<div class="col-md-6">
stuff
</div>
<div class="col-md-6">
stuff
</div>
</div>
<div class="row">
<div class="col-md-12">
stuff
</div>
</div>
</div>
</div>
Here is my exact code:
<div class="row" style="margin-top: 5px">
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon" id="">Destination City:</span>
<input type="text" class="form-control" id="DestinationCity" runat="server" placeholder="" aria-describedby="basic-addon1">
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon" id="">ETA:</span>
<input type="text" class="form-control" id="ETA2" runat="server" placeholder="" aria-describedby="basic-addon1">
</div>
</div>
</div>
<div class="row" style="margin-top: 5px">
<div class="col-md-12">
<div class="input-group">
<span class="input-group-addon" id="">B/L#:</span>
<input type="text" class="form-control" id="BL" runat="server" placeholder="" aria-describedby="basic-addon1">
</div>
</div>
</div>
I am trying to make 2 columns of 6 with a column of 12 underneath it. The second column will not span the entire length of the two 6s.
I think I am missing something fundamental about Bootstrap3's gridding system.
Link to image:
https://sutong-my.sharepoint.com/personal/joseph_sutongctr_com/_layouts/15/guestaccess.aspx?docid=1070ed3a0aabe43739b7cdda19e136793&authkey=AZFGucSF7ReMr4cvabz6fDQ
You HTML work perfectly as to what you wanted... 2 column followed by 1 columns spanning the entire page. You need to check if another div is wrapping it causing it to behave differently. Try to comment your start and ending div, you'd be surprised how many of us get confused.
Problem turned out to be a limit Visual Studio puts in Site.css
/* Set widths on the form inputs since otherwise they're 100% wide */
input,
select,
textarea {
max-width: 280px;
}
Answer found in Stack Question

bootstrap input box can not fill up the col, but just show up very short one

I am using bootstrop to draw my page, The code is below.
<div class="row">
<div class="col-lg-6">
Test
</div>
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
</div>
</div>
</div>
I am curious why the input box can not fill all of the 'col-lg-6' but just a little short.
Here is the fiddle portal.
Thanks a lot!
The issue is that your col-lg-6 class is applied to the outer <div> rather than the inside one.
Try this:
<div class="row">
<div class="col-lg-6">
Test
</div>
<div>
<div class="input-group; col-lg-6">
<input type="text" class="form-control" placeholder="Search for...">
</div>
</div>
</div>
Bootply results here.

Label in Bootstrap covers textboxes

I'm relatively new to having to actually style web pages and I'm having an issue with using Bootstrap. As shown in the bootply below, a simple page, using bootstrap columns and some custom styling, causes the labels to overlap the textboxes when the page is resized - for example, try narrowing the width of the page. What am I missing that is causing this behaviour?
http://www.bootply.com/ttuZZWim70
Thanks!
If you're attempting to create a horizontal form, you will want to add the appropriate Bootstrap horizontal form classes. Examples can be found at Horizontal Form. You would want to structure your html similar to the following with form-horizontal class on the form element and each group of labels/inputs with form-group. You can adjust the col-sm-* as necessary to organize your layout. It's best practice to try to get your column definitions col-*-* to add up to 12. Two get two form-group to display on a single row, you can utilize something like col-md-6 wrapped around each form-group.
<div class="container">
<div class="row">
<div class="col-md-12">
<form class="form-horizontal">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Long name test 1</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputEmail3" placeholder="Test">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Long name test 1</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputEmail3" placeholder="Test">
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
Here is a jsfiddle showing an example. You will need to extend the results window to be able to see the elements side by side. The horizontal form elements take up quite a bit of room so I might recommend giving each their own separate line similar to example on bootstrap.
Let me know if that helps.
Thanks!
You can try with the below link.
fiddle
<form class="well span12">
<div class="row">
<div class="span6">
<label>Long name test 1</label>
<input type="text" class="span6">
<label>Long name test 3</label>
<input type="text" class="span6">
</div>
<div class="span6">
<label>Long name test 2</label>
<input type="text" class="span6">
<label>Long name test 4</label>
<input type="text" class="span6">
</div>
</div>
</form>
Copy this and paste in your code Dam sure it will work.
<div class="form-group field">
<label>Email Address</label>
<input type="text" class="form-control" placeholder="Email Address">
</div>

Bootstrap grid layout: inputs expand 100% width at the halfway point

So I'm trying to create a simple responsive form using bootstrap grids, but it is being very tricky for me. You can ignore most of what I'm posting (the coldfusion for starters, is redundant) but pay attention to the grid classes!
<div id="custom-wrapper">
<div class="row">
<div class="col-lg-12">
<h1>Create Definitions</h1>
<div style="#display#" class="error-box alert alert-#alert#">#alertMsg#</div>
</div>
<!-- /.col-lg-12 -->
<div class="row">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-lg-10">
<form class="form-horizontal" id="addDef" action="index.cfm?group=#URL.group#" method="POST">
<div class="form-group"> <!--- state select --->
<label for="state" class="col-lg-3 control-label">Assign to State:</label>
<div class="col-lg-7">
<select id="states" name="states" class="form-control">
<cfloop query="state">
<option value="#state.ID#" name="state">#state.StateName#</option>
</cfloop>
</select>
</div>
</div>
<div class="form-group"> <!--- state select --->
<label for="sluglist" class="col-lg-3 control-label">Assign to Question:</label>
<div class="col-lg-7">
<select id="slugList" name="slugs" class="form-control">
<option selected>--- Choose a Slug ---</option>
<cfloop query="questions">
<option value="#questions.ID#" name="state">#questions.slug#</option>
</cfloop>
</select>
</div>
</div>
<div class="form-group" id="xhrHidden" style="display:none"> <!--- question text --->
<label for="term" class="col-lg-3 control-label">Question Text:</label>
<div class="col-lg-7">
<span id="questionText"></span>
</div>
</div>
<div class="form-group"> <!--- rich text div for definition --->
<label for="term" class="col-lg-3 control-label">Text Entry:</label>
<div class="col-lg-7">
<textarea name="term" id="term"></textarea>
<div>Define a term or phrase on a state by state basis.</div>
</div>
</div>
<div class="form-group"> <!--- group select --->
<label for="state" class="col-lg-3 control-label">Group: #group.GroupName#</label>
<div class="col-lg-7">
<div>#group.GroupName#</div>
</div>
</div>
<div class="form-group"> <!--- submit button --->
<label for="submit" class="col-lg-3 control-label"></label>
<div class="col-lg-7">
<input type="submit" class="btn btn-primary" id="submitbutton" value="Create Definition" />
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
What happens is they start out at about half the screen size, and when you shrink your browser, the grids shrink, and then suddenly, at about 50%, the inputs expand to what looks like 100% width, and then the next media query kicks in and it goes into normal sizing.
Could somebody explain why my grids would expand at about the halfway point?
Basically I'm having trouble using grids and having even widths across my elements, but it seems like the elements shouldn't be 100% of the grid, otherwise it takes up the whole page and is ugly.
Why my grids would expand at about the halfway point?
This is because you have only used .col-lg-* grid classes, which styles the columns for devices having large screens and leaves the elements untouched on lower screens.
Therefore the block-level elements such as <div> would fill the entire space of their parent.
Consider using col-md-* and/or col-sm-* classes as well in order to specify the width of columns on smaller screens, with the following order:
<div class="col-xs-* col-sm-* col-md-* col-lg-*">
For further info you could refer to my answer here:
What happens when grid classes apply to devices with smaller breakpoint size