PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, August 2, 2022

[FIXED] How to break <td> inbetween multiple <td>?

 August 02, 2022     css, html, html-table     No comments   

Issue

I have the below html.

 <tr>
     <td class="slds-cell-wrap" data-label="">Category</td>
     <td class="slds-cell-wrap break" data-label=""><strong> Test </strong></td>
     <td class="slds-cell-wrap" data-label="">Format</td>
     <td class="slds-cell-wrap break" data-label=""><strong>Test 1</strong></td>
</tr>

I want the output to be like below.

Category Format
Test     Test1

Note that the 2nd <td> and the 4th <td> are in a new line.

How do I achieve this using css?


Solution

display:grid is ideal for this.

tr {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 0.5em;
}
td.break {
  grid-row: 2;
}
  
<table>
   <tr>
     <td class="slds-cell-wrap" data-label="">Category</td>
     <td class="slds-cell-wrap break" data-label=""><strong> Test </strong></td>
     <td class="slds-cell-wrap" data-label="">Format</td>
     <td class="slds-cell-wrap break" data-label=""><strong>Test 1</strong></td>
  </tr>
</table>



Answered By - Alohci
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing