In tags you indicate that your question is related to Bootstrap 3
. So you need to understand the concept of grid
Examples to resolve your issue. Other concepts are margin
and padding
, but grid
is the most important here.
I also assumed that you have some knowledge of creating non-responsive sites.
And this is the problem.
After 15 years making websites with <table>
and then with CSS before CSS3, I also had a hard time understanding things like this.
I noticed that you speak in columns one beneath the other ... Columns stand side by side. Lines are one below the other.
In the bootstrap you nest columns within rows.
<div class="row">
<div class="col-md-4">coluna 4/12 = 1/3</div>
<div class="col-md-4">coluna 4/12 = 1/3</div>
<div class="col-md-4">coluna 4/12 = 1/3</div>
</div>
<div class="row">
<div class="col-md-3">.coluna 3/12 = 1/4</div>
<div class="col-md-4">coluna 4/12 = 1/3</div>
<div class="col-md-5">coluna 5/12</div>
</div>
This code creates two lines, each with three columns.
The first row has 3 columns of the same width, each one-third the size.
The second line also has 3 columns. each with a different size.
Did you notice that I divided by 12? It's because grid
of bootstrap
does this. It divides the screen width into 12 parts.
You may also have noticed md
. This is a class modifier that indicates that this rule applies to average monitors (think tablet).
That is col-md-3
, it can be read as a quarter (3/12 = 1/4) if the device screen is average.
Now, think of mobile first
, because the bootstrap rules are applied from the bottom up (in terms of size).
If you use col-sm-7
you will be saying occupy 7 spaces of 12, when the screen is small.
So, do not set absolute or percentage sizes for div
. Understand grid
and adapt the site layout to use it.
In responsive design, you can create a layout version for each screen size (old-fashioned, no-boom-like) and have the biggest headache to keep things running. Or you can better understand the concept and make a single code for any device.
Concepts to be studied: grid, margin and padding.
Boostrap site in Portuguese