Search code examples
csssassionic-frameworkionic-view

How to make a 3 grids design in Ionic where 1 grid on the left is double the size of 2 grids (one above the other in the right) sample in post


I want to make something just like this:

enter image description here

As you can see one big grid on the left double the size of two grids on the right (which are one above the other):

This is my html approach:

   <div class="content">
      <h1>SEGUROS</h1>
    </div>

    <section>

      <section class="taller-row">
        <div class="row">

          <div class="col standard-grid tall-grid">
            <img src="../img/ionic.png" class="img"/>

            <p>INFORMACIÓN<br> OTROS SEGUROS</p>

          </div>

        </div>
      </section>

      <section class="two-rows-in-one-column">
        <div class="row">
          <div class="col standard-grid right-cells">
            <img src="../img/ionic.png" class="img"/>

            <p>Dudas seguros de vida</p>
          </div>
        </div>

        <div class="row">

          <div class="col standard-grid">
            <img src="../img/ionic.png" class="img"/>

            <p>Dudas seguros exequias</p>
          </div>

        </div>
      </section>


    </section>

My css/sass looks like this:

#dashboard .col.standard-grid{
  width: 100%;
  height: 0;
  padding-bottom: 38%;

}

#dashboard .col.standard-grid p{
  margin-top: $std-grid-height - 73px;
  font-size: 12px;
  margin-left: 25%;
}

#dashboard .col.standard-grid img{
  height: 25px;
  margin-left: 5%;
  margin-top: $std-grid-height/3;
  float: left;
}

#dashboard .col.standard-grid.different-grid {
  background-color: $golden-color;
  color: white;
}
#dashboard .col.tall-grid {
  height: $tall-grid-height;
}

#dashboard .col.tall-grid p{
  margin-top: $tall-grid-height/2.5;
  margin-left: 1%;
  text-align: center;
}

#dashboard .col.tall-grid img{
  margin-top: $tall-grid-height/4;
  margin-left: 43%;
}

#dashboard .taller-row{
  float: left;
  width: 50%;
  height: 0;
  padding-bottom: 5%;
  margin: -20px -5px 0px 5px;
}

#dashboard .two-rows-in-one-column{
  width: 50%;
  float: right;
  margin: -20px 5px 0px -5px;

}

Solution

  • Here's the codepen - http://codepen.io/realin/pen/pjvzZw?editors=110

    <div class="row custom_grid">
        <div class="col positive-bg"></div>
        <div class="col no_padding_margin">
            <div class="row no_padding_margin">
                <div class="col energized-bg no_padding_margin"></div>
            </div>
            <div class="row no_padding_margin">
                <div class="col calm-bg no_padding_margin"></div>
            </div>
        </div>
    </div>
    </div>
    

    I have used ionic's built-in grid system. Click on the codepen link(shared above) to check the CSS and working example.