Wednesday, 29 October 2014

MAKE your world beautiful with BOOTSTRAP

GRID SYSTEM

1.<div class="container">

                    container

</div>

2.to make it visible use well
<div class="container">

                   <div class="well"> container</div>

</div>
3.add grey boundary to your container

<div class="container grey">

                   <div class="well"> container</div>

</div>

<style>
.grid
{
background-color:#ccc;
padding:20px;
}
</style>

4. to make it fully streched to the webpage wrap it under class grey.
<div class="grey">
<div class="container ">

                   <div class="well"> container</div>

</div>

</div>


CODING ROWS AND COLOUMN IN HTML

1. <div class="container">
             <div class="row">Row1 </div>
             <div class="row">Row2 </div>
             <div class="row">Row3 </div>
              <div class="row">Row4 </div>

  </div>

2.
 <div class="container">
             <div class="row"><div class="well">Row1 </div></div>
             <div class="row">Row2 </div>
             <div class="row">Row3 </div>
              <div class="row">Row4 </div>

  </div>

3.
 <div class="container">
             <div class="row">
                   <div class="col-lg-6">
                        <div class="well">column 1</div>
                      </div>
                    <div class="col-lg-6">
                        <div class="well">column 2</div>
                      </div>
</div>
</div>

we can have 12 columns so if we give lg-6 it means it going to have a span of 6 columns means it will cover exactly the half grid system.


now herein above we have 2 columns both covering half grid system.

4.

if you wana change the width of columns just change lg-4 in one and in another give as lg-8.


here lg stands for large in bootstrap.

note: so we can have any size columns in a row. maximum we can have is lg-1 with 12 columns and minimum lg-12 as one column or no coloumn.

eg: 4,4,2,2 will give you four columns with diff. span sizes.

5. lets take a look in controlling our grid in multiple devices also known as responsive site.

in above we have lg --- this means a large screen.
lg-6--- means there gonna be two column on a large screen.
the time you decrease size of screen it going to be a single column one below each other.



HOW CAN WE SOLVE THIS ISSUE?

a. try md -- medium instead of lg.
  so it will remain four column till a medium screen. somewhat relief hum.
 the time screen cross its limit that point is called BREAKPOINT.



b. try with sm---small (around 990pixels) and xs--- extra small (786 pixels)

c.<div class="col-xs-6 col-md-3">

this means in small screen you gona have 2 columns and in large its 6 columns.
logic: 3*4=12 so we have 4 columns
          6*2=12 we have two columns.

d. in our code we just writing a single word container inside each column.
what happen if we write large content inside  a single column and try to decrease the screen size.will it get messed up?/

YEAH IT WILL REALLY GET MESSED UP.CAN WE SOLVE IT?YEAH WATCH BELOW

1. To have a equal gaps between the rows and column we need to add a class called clearfix.

<div class="col-xs-6 col-md-3">columnjkefiudfgiiu coijfgioj jhrgio</div>
<div class="col-xs-6 col-md-3">column 2</div>
<div class="clearfix">


// if we just write clearfix it will be aplied for all screens but we don't want that to happen so  will make it hidden for lg and md as
<div class="clearfix hidden-md hidden-lg">


COLUMN OFFSET

What it means?
-- column spanning,means placng a column in you desired position.

How we do that?
-- <div class="container">  // a box not vidible to 
        <div class="row">  // a row class
           <div class="col-md-4"><div class="well">cloumn1</div></div>// left side column
           <div class="col-md-4 col-md-offset-4"><div class="well">column2</div></div>// offset or moved to right by 4 span




here we should see that 4+4+4=12 it satisfies the grid system however one of that 4 span got used in offseting the second column.


USING NESTED COLUMNS

1.to create nested column we need to create a row inside existing column

<div class="col-md-9">
   <div class="row">
      <div class="col-md-6"><div class="well"></div>
          <div class="col-md-6"><div class="well"></div>

  Now you might think the size of parent column is 9 and we are going beyond it.
but in grid system each row will be given 12 division width which is satisfied in our above code as 6+6=12.

COLUMN ORDERING

1. we can place our column in any desired position using pull and push.

            <div class="col-md-6 col-md-push">column1</div> //it will push column to 6 span right
             <div class="col-md-6 col-md-pull">column2</div>// it will pull by span 6 to left

 so the column 1 and 2 will be replaced.

No comments:

Post a Comment

hi provide your opinions here