Wednesday, November 9, 2022

[FIXED] how to divide css grid like first column 50%, second column 50% and third column 100%?

Issue


    .main-dev {
        display: grid;
        grid-template-columns: 50% 50%;
    }

I want to arrange my grid into 50% 50% and 100% structures. I have attached the required output image.

Current output :

Grid in four box

Expected Output :

Grid device in 50% 50% and 100%


Solution

.item {
  border: 1px solid red;
  text-align: center;
  padding: 10px;
}

.main-dev {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 200px;
  border: solid red 1px;
}

.item3 {
  grid-column: 1 / 3;
  /* or grid-column: 1 / span 2 */
}
<div class="main-dev">
  <div class="item">1</div>
  <div class="item">2</div>
  <div class="item item3">3</div>



Answered By - Arman Ebrahimi
Answer Checked By - Terry (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.