Why space is coming in between text using bootstrap? - asp.net

I am getting so much space between the text. I am using form-group. I don't know why. I am new to Bootstrap.
Code:
<div class="wrapper">
<asp:Panel ID="Panel1" runat="server">
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<div align="left" style="padding-bottom:10px;margin-left:50px;"><b>Exhibitors Passport</b> </div>
</div>
<div class="col-md-6"></div>
<div class="clearfix"></div>
</div>
</div>
<div class="container-fluid">
<section class="container">
<div class="row-fluid">
<div class="form-group col-md-12">
<div class="col-md-6">
<h3 style="color:#fc2630;font-size:14px;padding-bottom:15px;">
Please Submit Exhibitor Passport Details :</h3>
</div>
</div>
</div>
<div class="row-fluid">
<div class="form-group col-md-12">
<div class="col-md-6" style="color:#5a5b5b;font-size:14px;font-weight:bold;">
Delegate Details - 1:
<asp:CheckBox ID="chk1_" runat="server" Checked="True" Visible="False" />
</div>
<div class="col-md-6"></div>
</div>
</div>
</section>
</div>
</asp:Panel>
</div>

I think it's not because of Bootstrap. You have some padding in your style attributes.
http://codepen.io/anon/pen/bMbEbO

Related

Padding between columns in CSS

I would like to know if there's a better solution to solve the space problem between the two first columns in this code: https://jsfiddle.net/5vtc1Lhp/#&togetherjs=qkIyJnDkmf
I did try to place div inside div, but the width of the div decreased in the first example ( at the top). At the botton it works fine, but I had to define a padding value in px which I don't like since it's a fixed value and I don't know if this spacement should change automatically.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-8">
<div class="col-md-12">
<div class="col-md-4">
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
<div class="col-md-8">
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
</div>
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
<div class="col-md-4">
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
</div>
</div>
</div>
<hr>
Bellow is OK.
<hr>
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-8">
<div class="col-md-4 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
<div class="col-md-8" style="padding: 0 0px 0 30px;">
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
<div class="col-md-4">
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
</div>
</div>
</div>
Thank you!
Container gives gutter of 30px(15px on left and right)
If you remove the container and give it a row.It will give -15px padding on both sides. And that's what you are looking for, right?
<div class="row">
<div class="col-md-8">
<div class="row">
<div class="col-md-4">
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
<div class="col-md-8">
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
</div>
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
<div class="col-md-4">
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
<div class="col-md-12 well text-center">
...<br>...<br>...<br>...<br>...<br>...<br>...
</div>
</div>
</div>

Show 1 row on desktop and 2 rows on mobile

This basic bootstrap CSS shows me 4 columns on 1 row:
<div class="row">
<div class="col-md-3">
Text
</div>
<div class="col-md-3">
Text
</div>
<div class="col-md-3">
Text
</div>
<div class="col-md-3">
Text
</div>
</div>
For the mobile view I would like to display 2 columns on 2 rows. The only way that I know how to do this is to create the same content twice ... something like this:
<div class="desktop">
<div class="row">
<div class="col-md-3">
Text
</div>
<div class="col-md-3">
Text
</div>
<div class="col-md-3">
Text
</div>
<div class="col-md-3">
Text
</div>
</div>
</div>
<div class="mobile">
<div class="row">
<div class="col-xs-6">
Text
</div>
<div class="col-xs-6">
Text
</div>
</div>
<div class="row">
<div class="col-xs-6">
Text
</div>
<div class="col-xs-6">
Text
</div>
</div>
</div>
So you can set display:none for the classes desktop and mobile using #media ...
That would work but it is not the cleanest solution. Would there be another way to do this?
You don't have to write separate code for smaller devices and larger devices. Following code snippet will serve your purpose.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-md-3 col-xs-6">
1
</div>
<div class="col-md-3 col-xs-6">
2
</div>
<div class="col-md-3 col-xs-6">
3
</div>
<div class="col-md-3 col-xs-6">
4
</div>
</div>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-md-3 col-xs-6">
1
</div>
<div class="col-md-3 col-xs-6">
2
</div>
<div class="col-md-3 col-xs-6">
3
</div>
<div class="col-md-3 col-xs-6">
4
</div>
</div>

Best approach to divide Bootstrap grid columns

I have divided my Bootstrap grid columns following way.
<div class="container-fluid">
<div class="row">
<div class="col-md-3">A</div>
<div class="col-md-6">
<div class="col-md-12">B1</div>
<div class="col-md-12">
<div class="col-md-8">B1.1</div>
<div class="col-md-4">B1.2</div>
</div>
<div class="col-md-12">
<div class="col-md-10">B2.1</div>
<div class="col-md-2">B2.2</div>
</div>
</div>
<div class="col-md-3">C</div>
</div>
</div>
Please find below of visual layout of this code.
Is my approach of dividing grid columns correct or wrong?
Always wrap your column inside a row to avoid any css break when resizing/or something like that
<div class="container-fluid">
<div class="row">
<div class="col-md-3">A </div>
<div class="col-md-6">B
<div class="row">
<div class="col-md-12">B1</div>
</div>
<div class="row">
<div class="col-md-8">B1.1</div>
<div class="col-md-4">B1.2</div>
</div>
<div class="row">
<div class="col-md-10">B2.1</div>
<div class="col-md-2">B2.2</div>
</div>
</div>
<div class="col-md-3">C </div>
</div>
</div>
You should add row divs for children inside B.
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
A
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-12">B1</div>
</div>
<div class="row">
<div class="col-md-8">B1.1</div>
<div class="col-md-4">B1.2</div>
</div>
<div class="row">
<div class="col-md-10">B2.1</div>
<div class="col-md-2">B2.2</div>
</div>
</div>
<div class="col-md-3">
C
</div>
</div>
</div>
Just add an row div inside B for every line of columns inside: b, b1.1, b1.2 and b2.1, b2.2. This should help.
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
A
</div>
<div class="col-md-6">
<div class='row'>
<div class="col-md-12">B1</div>
</div>
<div class='row'>
<div class="col-md-8">B1.1</div>
<div class="col-md-4">B1.2</div>
</div>
<div class='row'>
<div class="col-md-10">B2.1</div>
<div class="col-md-2">B2.2</div>
</div>
</div>
<div class="col-md-3">
C
</div>
</div>
</div>
You should always wrap your columns inside the row for better layout without spacing in the columns or clearfix for layout with spacing:
<div class="container-fluid">
<div class="row">
<div class="col-md-3">A</div>
<div class="col-md-6">
<div class="clearfix">
<div class="col-md-12">B1</div>
</div>
<div class="clearfix">
<div class="col-md-12">
<div class="clearfix">
<div class="col-md-8">B1.1</div>
<div class="col-md-4">B1.2</div>
</div>
</div>
</div>
<div class="clearfix">
<div class="col-md-12">
<div class="clearfix">
<div class="col-md-10">B2.1</div>
<div class="col-md-2">B2.2</div>
</div>
</div>
</div>
</div>
<div class="col-md-3">C</div>
</div>
</div>
You might be interested to see this Q/A, Remove padding from columns.

Border layout with bootstrap

Is it possible to build a border layout with bootstrap, that centers the labels of the right and left borders, keeps the bottom at the bottom of the page and fills the content with all space left over in the center?
New to bootstrap, but even with the help of google I just came up with this:
div class="container">
<div class="row">
<div class="col-xs-1">
<div class="left-box">
<div class="turn-left">left</div>
</div>
</div>
<div class="col-xs-10">
<div class="row">
<div class="col-xs-12">
<div class="top-box">top</div>
</div>
<div class="col-xs-12">
<div class="content-box">content</div>
</div>
<div class="col-xs-12">
<div class="bottom-box">bottom</div>
</div>
</div>
</div>
<div class="col-xs-1">
<div class="right-box">
<div class="turn-right">right</div>
</div>
</div>
</div>
https://jsfiddle.net/fbtw6/352
The result is not very convincing - what am I doing wrong?
See it this works for you.
<div class="container">
<div class="page-header">
<div class="row">
<div class="col-xs-1">
<div class="left-box">
<div class="turn-left">left</div>
</div>
</div>
<div class="col-xs-10">
<div class="row">
<div class="col-xs-12">
<div class="top-box">top</div>
</div>
<div class="col-xs-12">
<div class="content-box">content</div>
</div>
</div>
</div>
<div class="col-xs-1">
<div class="right-box">
<div class="turn-right">right</div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p>sticky footer</p>
</div>
</footer>
I used this example to assemble.
Like this any better?

Bootstrap 3 center container div

I can't seem to find the way to center a container that has a couple of images and a label. Here is the code:
<div class="container">
<div class="row">
<div class="col-sm-1" style="width:88px;padding-left:0px">
<img id="Img1" runat="server" src="images/image1.gif" />
</div>
<div class="col-sm-8" style="height:60px">
<div class="row">
<div class="col-sm-12 BaseColor1" style="text-align:center">
<img id="Img2" runat="server" src="images/image2.gif" />
</div>
</div>
<div class="row" style="background-color:white;color: black;text-align:center">
<div class="col-sm-12" style="vertical-align:central">
<asp:Label Runat="server" Height="26px" ID="lblComp">COMPANY</asp:Label>
</div>
</div>
</div>
</div>
</div>
How do I make the entire container div or the "row" div (below) to center in the browser?
Try adding "margin:0 auto"
<div class="container" style="margin:0 auto">
<div class="row">
<div class="col-sm-1" style="width:88px;padding-left:0px">
<img id="Img1" runat="server" src="images/image1.gif" />
</div>
<div class="col-sm-8" style="height:60px">
<div class="row">
<div class="col-sm-12 BaseColor1" style="text-align:center">
<img id="Img2" runat="server" src="images/image2.gif" />
</div>
</div>
<div class="row" style="background-color:white;color: black;text-align:center">
<div class="col-sm-12" style="vertical-align:central">
<asp:Label Runat="server" Height="26px" ID="lblComp">COMPANY</asp:Label>
</div>
</div>
</div>
</div>
</div>
You can also see this post about using Bootstrap's "offsets"

Resources