Created
September 6, 2019 23:34
-
-
Save pianomanfrazier/e9a1b37ac3e6ac064b2f77e9e8660657 to your computer and use it in GitHub Desktop.
Playing around with this fiddle https://jsfiddle.net/zinoui/BmLpV/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en"> | |
<head> | |
<title>Fancy HTML Table</title> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<meta charset="utf-8"> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale = 1.0, maximum-scale=1.0, user-scalable=no"> | |
<link rel="stylesheet" href="main.css"> | |
<style> | |
body { | |
max-width: 40em; | |
margin: 5em auto; | |
} | |
th { | |
border-top: 1px solid black; | |
background-color: beige; | |
} | |
th, | |
td { | |
border-bottom: 1px solid black; | |
border-right: 1px solid black; | |
border-collapse: collapse; | |
border-spacing: 0; | |
white-space: wrap; | |
} | |
th:first-child, | |
td:first-child { | |
border: none; | |
border-top: 1px solid black; | |
} | |
table { | |
border: none; | |
border-collapse: separate; | |
border-spacing: 0; | |
} | |
th, | |
td { | |
padding: 1em; | |
} | |
td { | |
padding-bottom: 10px; | |
} | |
.wrapper { | |
position: relative; | |
background-color: bisque; | |
width: 40em; | |
padding-right: 200px; | |
} | |
.container { | |
width: 40em; | |
overflow: auto; | |
margin-left: 200px; /* offset the width of col1 */ | |
/* border-left: 1px solid red; */ | |
} | |
.col1 { | |
width: 168px; /* magic number */ | |
position: absolute; | |
left: 0; | |
top: auto; | |
background-color: azure; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="wrapper"> | |
<div class="container"> | |
<table> | |
<thead> | |
<tr> | |
<th class="col1">Fixed Column</th> | |
<th>Data 1</th> | |
<th>Data 2</th> | |
<th>Data 3</th> | |
<th>Data 4</th> | |
<th>Data 5</th> | |
<th>Data 6</th> | |
<th>Data 7</th> | |
<th>Data 8</th> | |
<th>Data 9</th> | |
<th>Data 10</th> | |
<th>Data 5</th> | |
<th>Data 6</th> | |
<th>Data 7</th> | |
<th>Data 8</th> | |
<th>Data 9</th> | |
<th>Data 10</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td class="col1">COLUMN 1</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
<td>Some data stuff</td> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
<!-- external scripts --> | |
<script src="main.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment