css - Table-cell doesn't fit its content -
i have table css , structure:
table, td { border: 3px solid #208000; border-collapse: collapse; font-size: 75%; } .headingtable { text-align: center; padding: 1%; } @media screen , (min-width: 768px) { table, td { border: 3px solid #208000; font-size: 100%; } .headingtable { font-size: 100%; } } @media screen , (min-width: 1200px){ table, td { border: 5px solid #208000; } .headingtable { font-size: 125%; } }
<table> <caption>table caption</caption> <thead> <tr> <td class = "headingtable">first</td> <td class = "headingtable">second</td> <td class = "headingtable">third</td> <td class = "headingtable">fourth</td> <td class = "headingtable">fifth</td> </tr> </thead> <tbody> <tr> <td class = "headingtable">1</td> <td>lorem ipsum dolor </td> <td>sit amet, consectetur adipiscing elit. in pulvinar maximus massa, id sollicitudin urna iaculis sit amet. </td> <td>mauris tincidunt augue erat, ac </td> <td> accumsan justo volutpat id</td> </tr> </tbody> </table>
due class headingtable text of thead , first column increased 25% font-size @ screen width wider 1200px.
, @ screen width first cell in thead doesn't fit it's content ("first").
first column includes one-digit numbers, therefore don't overflow borders of cells.
have mention table contains 40 rows.
so, question can make first cell in thead fit content?
this solve problem <td><div class = "headingtable"> first</div></td>
table, td { border: 3px solid #208000; border-collapse: collapse; font-size: 75%; } .headingtable { text-align: center; padding: 1%; } @media screen , (min-width: 768px) { table, td { border: 3px solid #208000; font-size: 100%; } .headingtable { font-size: 100%; } } @media screen , (min-width: 1200px){ table, td { border: 5px solid #208000; } .headingtable { font-size: 125%; } }
<table> <caption>table caption</caption> <thead> <tr> <td><div class = "headingtable"> first</div></td> <td class = "headingtable">second</td> <td class = "headingtable">third</td> <td class = "headingtable">fourth</td> <td class = "headingtable">fifth</td> </tr> </thead> <tbody> <tr> <td class = "headingtable">1</td> <td>lorem ipsum dolor </td> <td>sit amet, consectetur adipiscing elit. in pulvinar maximus massa, id sollicitudin urna iaculis sit amet. </td> <td>mauris tincidunt augue erat, ac </td> <td> accumsan justo volutpat id</td> </tr> </tbody> </table>
Comments
Post a Comment