Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I force the column to display in the next row?

Tags:

html

css

I have more than five to six column it will increase in the future. I have to display each row with three column. So how do I force the column to display in the next row? I set parent class display: table and child class display:table-cell because I have to display the equal height of the column.

I am getting the output like this enter image description here

I need output like this. enter image description here

.table {
  display: table;
  border-collapse: separate;
  border-spacing: 30px 0px;
  width: 100%;
}

.row { display:table-row;width: 100%; }

li{
  display:table-cell;
  padding:5px;
  background-color: gold;
  width: 33.33%;
  text-align: center;
}
<div class="table">
    <ul class="row">
        <li>Cell 1</li>
        <li>Cell 2</li>
        <li>Cell 3</li>
        <li>Cell 4</li>
        <li>Cell 5</li>
        <li>Cell 6</li>
    </ul>
</div>
like image 531
user9437856 Avatar asked Apr 03 '18 07:04

user9437856


People also ask

How to change the beginning cell column of the next row?

In the Microsoft Visual Basic for Applications window, double click ThisWorkbook in the left pane to open the ThisWorkbook (Code) window. Then copy and paste the below VBA code into the window. Note: In the VBA code, “A” is the beginning cell column of the next row. You can change it as you need.

How to move a row to the next row in Excel?

Select any one or more (but preferably all) cells in the row you want moved, go to Format> Paragraph> Line & Page Breaks, check the Keep with next box, then OK.

How do you freeze a row in Excel with multiple cells?

The general rule is, the pane will be frozen ABOVE and to the LEFT of the cell (s) you have selected. For example, if you want to freeze ROW 1, select all of ROW 2, if you want to freeze COLUMN A, select all of COLUMN B, if you want to freeze ROW 1 AND COLUMN A, select CELL B2, etc.

How do I jump to the beginning of the next row?

Sub jumpnext() Range("A" & ActiveCell.Row + 1).Select End Sub. Note: In the VBA code, “A” is the beginning cell column of the next row. You can change it as you need. 3. Press the F5 key, then the cursor will move to the beginning of next row immediately.


1 Answers

I prefer this one as well. You can see here: JSFiddle

* {
  box-sizing: border-box;
}
.table .row {
  display: flex;
  flex-wrap: wrap;
  list-style:none
}

.table .row li {
  background: orange;
  width: 33%;
  text-align: center;
  line-height: 100px;
  border: 5px solid white;
}

.table + .table li {
  background: olive;
}
<div class="table">
    <ul class="row">
        <li>Cell 1</li>
        <li>Cell 2</li>
        <li>Cell 3</li>
        <li>Cell 4</li>
        <li>Cell 5</li>
        <li>Cell 6</li>
    </ul>
</div>

<div class="table">
    <ul class="row">
        <li>Cell 1</li>
        <li>Cell 2</li>
        <li>Cell 3</li>
        <li>Cell 4</li>
    </ul>
</div>
like image 96
Shiva Avatar answered Oct 31 '22 17:10

Shiva