RISHABH BANSAL
RISHABH BANSAL

Reputation: 95

How to place a container (two rows) inside with two containers (in two different rows) in bootstrap?

How to place a container (two rows) with two containers (in two different rows) in bootstrap?enter image description here

i want containers arranged like this

Upvotes: 0

Views: 2965

Answers (2)

KiranPurbey
KiranPurbey

Reputation: 335

Use this code:

<!DOCTYPE html>
<html>
  <head>
    <title>Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <style type="text/css">
      .gray{border:5px solid gray;
        height: 100px;


      }
      .green{border: 5px solid green;
        height: 300px;
     }

        .orange{
          border: 5px solid orange;
          height: 350px;

        }

         .greenplus{border: 5px solid green;
        height: 50px;
       }
    </style>
    <body>
      <div class="container" style="margin-top: 50px;">
        <div class="row" >
          <div class="col-lg-8 col-sm-8 col-md-8">
            <div class="row"  style="padding-left: 20px; padding-right: 20px;">
              <div class="gray"></div>
             <br>
               <div class="green"></div>
             </div>
          </div>
          <div class="col-lg-4 col-sm-4 col-md-4">
            <div class="row" style="padding-left: 20px; padding-right: 20px;">
               <div class="orange"></div>
               <br>
               <div class="greenplus"></div>
             </div>
          </div>
        </div>
      </div>
    </body>
</html>

Upvotes: 0

Reinards Saulitis
Reinards Saulitis

Reputation: 47

You can use grid to do these kind of things. Can you Illustrate what should it look like?(I could help you more then)

EDIT: For this you actually need just a row with two columns.

And it will look like this:

    <div class="row">

      <div class="col-md-8">  <!-- 8 is the width of the left side -->

        You content here

      </div>

     <div class="col-md-4">  <!-- 4 is the width of the right side -->

        Your content here

      </div>

    </div>

If you need so that the content inside of those columns is also a grid, then it will be a bit different:

   <div class="row">

      <div class="col-md-8">  <!-- 8 is the width of the left side -->

       <div class="row">
          <div class="col-md-12"></div>
          <!-- You just add your columns here -->
       </div>

       <div class="row">
          <div class="col-md-12"></div>
          <!-- You just add your columns here -->
       </div>

      </div>

     <div class="col-md-4">  <!-- 4 is the width of the right side -->

        <div class="row">
          <div class="col-md-12"></div>
          <!-- You just add your columns here -->
       </div>

       <div class="row">
          <div class="col-md-12"></div>
          <!-- You just add your columns here -->
       </div>

      </div>

    </div>

Upvotes: 1

Related Questions