[CSS3] Responsive Table -- no more table
When the screen size is small, we can use "no more table" solution. So instead of render table is row layout, we render it in column layout.
Given the table below:
<table>
<thead>
<tr>
<th>Team</th>
<th>1st</th>
<th>2nd</th>
<th>3rd</th>
<th>4th</th>
<th>5th</th>
<th>6th</th>
<th>7th</th>
<th>8th</th>
<th>9th</th>
<th>Final</th>
</tr>
</thead>
<tbody>
<tr>
<td data-th="Team">Toronto</td>
<td data-th="1st">0</td>
<td data-th="2nd">0</td>
<td data-th="3rd">0</td>
<td data-th="4th">4</td>
<td data-th="5th">0</td>
<td data-th="6th">1</td>
<td data-th="7th">0</td>
<td data-th="8th">0</td>
<td data-th="9th">0</td>
<td data-th="Final">5</td>
</tr>
<tr>
<td data-th="Team">San Francisco</td>
<td data-th="1st">0</td>
<td data-th="2nd">0</td>
<td data-th="3rd">0</td>
<td data-th="4th">4</td>
<td data-th="5th">0</td>
<td data-th="6th">0</td>
<td data-th="7th">0</td>
<td data-th="8th">0</td>
<td data-th="9th">0</td>
<td data-th="Final">4</td>
</tr>
</tbody>
1. Reset table relatede element to block element:
table, thead, tbody, th, td, tr {
display: block;
}
2. Remove the thead:
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
3. Position layout:
/*The actually content will be on the right side*/
td {
position: relative;
padding-left: 50%;
} /*Using data-th to set the value and set position to left*/
td:before {
position: absolute;
left: 6px;
content: attr(data-th);
font-weight: bold;
}
Full example:
[CSS3] Responsive Table -- no more table的更多相关文章
- OpenFlow Switch学习笔记(五)——Group Table、Meter Table及Counters
本文主要详述OpenFlow Switch的另外两个主要组件——Group Table和Meter Table,它们在整个OpenFlow Swtich Processing中也起到了重要作用. 1. ...
- delete table 和 truncate table
delete table 和 truncate table 使用delete语句删除数据的一般语法格式: delete [from] {table_name.view_name} [where< ...
- MySQL删除大表时潜在的问题(drop table,truncate table)
来源于:https://www.cnblogs.com/CtripDBA/p/11465315.html,侵删,纯截图,避免吸引流量之嫌 case1,删除大表时,因为清理自适应hash索引占用的内容导 ...
- 【翻译】Flink Table Api & SQL —— Table API
本文翻译自官网:Table API https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/table/tableApi.ht ...
- 【table】给table表格设置一个通用的css3样式(默认有斑马条纹)
/* = 表格(默认有斑马条纹) ------------------------------------------ */ .data-table { margin: 10px 0; } .data ...
- 【SqlServer】empty table and delete table and create table
1.建表 1 IF object_id (N'表名', N'U') IS NULL CREATE TABLE 表名 ( 2 id INT IDENTITY (1, 1) PRIMARY KEY ,.. ...
- 【MySQL】 empty table and delete table.
1.MySQL生成删除满足条件的表的sql: 1 SELECT 2 CONCAT( 3 'DROP TABLE ', 4 GROUP_CONCAT(table_name), 5 ';' 6 ) AS ...
- 页面动态table动态合并table
function hebingRows(col, atrrb) { var trs = $("table tbody tr"); var rows = 1; for (var i ...
- truncate table和delete table 的区别
truncate table和不带 where 的 detele 功能一样,都是删除表中的所有数据. 但TRUNCATE TABLE 速度更快,占用的日志更少,这是因为 TRUNCATE TABLE ...
随机推荐
- 为什么网络银行不支持GNU/Linux操作系统下的浏览器操作
当年Linux没出时.银行就開始信息化建设了. 所为信息化,就是指用计算机工作了.服务客户了. 顺带着,慢慢的建server,连网(内部网).外网(网上银行) 这样下来, unix, dos, win ...
- Android 运行 gson.toJson(object) 报java.lang.StackOverflowError异常
如以下的代码,运行后报java.lang.StackOverflowError错误: MusicSavedInfo musicSavedInfo=new MusicSavedInfo(currentS ...
- UVALive 3027 Corporative Network 带权并查集
Corporative Network A very big corporation is developing its corporative networ ...
- ASP.NET Core-组件-后台任务:Hangfire
ylbtech-ASP.NET Core-组件-后台任务:Hangfire Hangfire作为一款高人气且容易上手的分布式后台执行服务,支持多种数据库.在.net core的环境中,由Core自带的 ...
- 35.QT蝴蝶飞舞
fly.h #ifndef FLY_H #define FLY_H #include <QObject> #include <QPainter> #include <QG ...
- SQL语句之Insert
插入常见的3种形式: 单条插入, 批量插入, 返回刚插入行的id http://www.cnblogs.com/yezhenhan/archive/2011/08/17/2142948.html
- Flask_URL和视图
1.Flask_URL和视图 1.1.第一个flask程序 from flask import Flask #创建一个Flask对象,传递__name__参数进去 app = Flask(__na ...
- 如何安装windows系统
前言:装系统有两种方式,一种是下载系统镜像文件后解压ios文件到除c盘以外其他盘都可(如原系统是win10系统,则可以直接右键加载,而不必解压),然后运行.exe文件就可以自动安装了.这种方法在新款电 ...
- Python学习小计
1.初学Python最好选择2.7版本,因为大部分Python书籍的示例代码是基于这个版本的 2.Python安装可以参考百度经验完成 如果在电脑上同时安装2个版本,则CMD启动时只需要: py -2 ...
- 案例分析:大数据平台技术方案及案例(ppt)
大数据平台是为了计算,现今社会所产生的越来越大的数据量,以存储.运算.展现作为目的的平台.大数据技术是指从各种各样类型的数据中,快速获得有价值信息的能力.适用于大数据的技术,包括大规模并行处理(MPP ...