Skip to content

Instantly share code, notes, and snippets.

@denniskuczynski
Created February 22, 2012 22:37
Show Gist options
  • Save denniskuczynski/1888038 to your computer and use it in GitHub Desktop.
Save denniskuczynski/1888038 to your computer and use it in GitHub Desktop.
Large HTML Data Table With A Fixed Left Column and Overflow Scrolling on the Right (With Tables)
<style>
#list {
float: left;
width: 10%;
overflow: hidden;
}
#list ul {
padding: 0;
margin: 0;
}
#list li {
display: block;
border: 1px solid black;
height: 20px;
}
#table {
float: left;
width: 90%;
overflow: scroll;
<% if @overflow %>-webkit-overflow-scrolling : touch;<% end %>
}
#table table, tr {
border-spacing: 0px
}
#table th, td {
border: 1px solid black;
border-spacing: 0px
}
#table .column {
display: block;
width: 100px;
height: 18px;
}
</style>
<div id="list">
<ul>
<li>Number</li>
<% 150.times do |number| %>
<li><%= number %></li>
<% end %>
</ul>
</div>
<div id="table">
<table>
<thead>
<tr>
<% 150.times do |number| %>
<th><span class="column"><%= number %></span></th>
<% end %>
</tr>
</thead>
<tbody>
<% 150.times do |number| %>
<tr>
<% 150.times do |number2| %>
<td><span class="column"><%= number * number2%></span></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment