html - How to style a table in CSS for mobile phones -
html - How to style a table in CSS for mobile phones -
i want re-style table formatted in mobile phones. have made dummy illustration explain problem new styles applied (the original table much bigger):
<table> <thead><tr> <th>firstname</th> <th>lastname</th> <th>savings</th> </tr></thead> <tr> <td>peter</td> <td>griffin</td> <td>$100</td> </tr> <tr> <td>lois</td> <td>lorem ipsum dolor sit down amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim advertisement minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore european union fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</td> <td>$150</td> </tr> </table> and styles this:
/*mobile style*/ table, thead, tbody, tr, th, td { display: block; } table { margin: 0.5em auto 1em; font-size:90%; } td { border: 1.5px groove; text-align:center; } thead{ display: none; } tr { margin-top: 0.5em; border: 1.5px groove; } td:before { float: left; width: 6em; border: 1.5px groove; font-weight:bold; } td:before {content: "firstname";} td+td:before {content: "lastname";} td+td+td:before {content: "savings";} jsfiddle
the result looks fine, if info in 1 field larger line, content overflows cell:
how can adjust content cell , enlarge 'lastname' cell in case?
edit:
i think wasn't clear plenty wanted achieve, here is:
you can utilize word wrap maintain info within cell
html css css3
Comments
Post a Comment