Toggle Menu
  • Home
    • About Us
    • Contact
    • Portfolio
    • Site Map
  • Expression Web Tutorials
    • Installing Expression Web 4
    • Setting Up Expression Web 4.0
    • Create New Website
    • Create a Blank Web Page
    • Create a Webpage Layout
    • Adding Horizontal Top Navigation
    • Adding Vertical Navigation
    • Validating Your Pages
    • Creating an Expression Web Dynamic Web Template
    • Publishing Your Web Site
    • How to back up your local website on your hard drive
    • SEO Checker and Report
    • Adding Insert Include Code into Code Snippets
    • Auto Thumbnail in Expression Web
    • Broken Dynamic Web Templates and hidden metadata files
    • Code Snippets in Expression Web
    • Compatibility Checker on Status Bar in Expression Web
    • Create and Style a Data Table
    • Creating a New Font Family Group
    • Creating a New Page from Hyperlink Properties
    • Creating web site from site templates in Expression Web
    • CSS Properties panel
    • Expression Web Preview in Browser
    • Expression Web and Design Time Includes
    • How to back up your local website on your hard drive
    • How to create a Personal Web Package
    • Import Site Wizard in Expression Web
    • Importing your folders/files into Expression Web
    • Inserting Images in Expression Web
    • Interactive Buttons in Expression Web
    • Migrating a FrontPage Site to Expression Web
    • Modify Style Dialog Box
    • New Style Dialog Box
    • Publishing Your Website from the Remote Server with FrontPage Server Extensions
    • Editing Reusable Forms
    • Troubleshooting Image Problems in Expression Web
    • Validation Error - no attribute "xmlns:v"
    • Web Album Generator and Expression Web
    • What are all the style# in my page?
    • Zoom Search and Expression Web
    • Working With Left Border Background Images
  • Resources
    • Accessible Color - Color Contrast
    • CSS Basics
    • Expression Web eBooks
    • Guide to Dealing With Google's Malware Warnings
    • HTML Cleaner
    • HTML Washer
    • Huggins Email Form Script
    • Free Forms
    • Learn HTML
    • Migrating from FrontPage to Expression Web
    • Newbies
    • Search Engine Optimization - SEO
  • Templates
    • Complete Site Templates
    • Expression Web In Box Templates
    • Dynamic Web Templates
    • Mobile Friendly Site Templates
    • Crafting Series
    • Christmas Templates
  • Web Design Tutorials
    • Accessible Forms
    • Add a Search Box
    • Adding Google Search
    • Accessible Data and Layout Tables
    • Responsive Tables
    • Anchor Tags and Name Attributes
    • Best Font Size for Web Design?
    • Center Page in Browser Window
    • HTML Lists
    • How to create and extract a Zip File in Windows
    • How to Create a Self-Extracting Zip File
    • Validation Error - no attribute "xmlns:v"
    • Working With Left Border Background Images
    • Handle Background Transparency in Snagit Editor Like You Would in Photoshop
  • Bluehost Tutorials
    • Add-on Domains at BlueHost
    • BlueHost 301 Redirects
    • BlueHost Webmail
    • Customizing BlueHost Error Pages
    • How to make a subfolder the main folder for your BlueHost main domain
    • How to change the Primary Domain
    • Installing a WordPress Blog Using Simple Scripts
    • Mannaging SSL on BH
    • Password Protecting Directories and/or Files with Bluehost
    • Server Side Includes, BlueHost, and Expression Web
  • Expression Web Addins
    • Ajatix Email Spam Blocker
    • Ajatix Advanced CSS Drop Down Menu
    • Ajatix Lightbox Add-In
    • Ajatix Image / Banner Slider

Data Tables

Data tables display information in a grid-like format of rows and columns. They organize information in a way that’s easy to scan so that users can look for patterns and develop insights from data. Genealogists use them quite often to display information on their websites. Product information is also displayed in data tables.

How do you fit a wide data table so it is readable on a mobile screen? You can collapse the table rows so they show as separate cards.

I have been using a PVII Mobile Friendly Tables extension for Dreamweaver to create mobile friendly tables but went in search of a free solution when the question of "how to" recently came up.

Responsive Data Tables

Chris Coyier of CSS Tricks presented this solution to creating responsive data tables. No javascript required, just css.

You can read the article Responsive Data Tables which uses the sample shown below.

First Name Last Name Job Title Favorite Color Wars or Trek? Secret Alias Date of Birth Dream Vacation City GPA Arbitrary Data
James Matman Chief Sandwich Eater Lettuce Green Trek Digby Green January 13, 1979 Gotham City 3.1 RBX-12
The Tick Crimefighter Sorta Blue Wars John Smith July 19, 1968 Athens N/A Edlund, Ben (July 1996).
Jokey Smurf Giving Exploding Presents Smurflow Smurf Smurflane Smurfmutt Smurfuary Smurfteenth, 1945 New Smurf City 4.Smurf One
Cindy Beyler Sales Representative Red Wars Lori Quivey July 5, 1956 Paris 3.4 3451
Captain Cool Tree Crusher Blue Wars Steve 42nd December 13, 1982 Las Vegas 1.9 Under the couch

Using this same solution, you can see the following examples:

  • Blackbird Designs Inventory Chart
  • Furniture Product List

/*
Generic Styling, for Desktops/Laptops
*/
table {
width: 100%;
border-collapse: collapse;
}
/* Zebra striping */
tr:nth-of-type(odd) {
background: #eee;
}
th {
background: #333;
color: white;
font-weight: bold;
}
td, th {
padding: 6px;
border: 1px solid #ccc;
text-align: left;
}

/*
Max width before this PARTICULAR table gets nasty
This query will take effect for any screen smaller than 760px
and also iPads specifically.
*/
@media
only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px) {

/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
display: block;
}

/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}

tr { border: 1px solid #ccc; }

td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: 50%;
}

td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
white-space: nowrap;
}

/*
Label the data
*/
td:nth-of-type(1):before { content: "First Name"; }
td:nth-of-type(2):before { content: "Last Name"; }
td:nth-of-type(3):before { content: "Job Title"; }
td:nth-of-type(4):before { content: "Favorite Color"; }
td:nth-of-type(5):before { content: "Wars of Trek?"; }
td:nth-of-type(6):before { content: "Secret Alias"; }
td:nth-of-type(7):before { content: "Date of Birth"; }
td:nth-of-type(8):before { content: "Dream Vacation City"; }
td:nth-of-type(9):before { content: "GPA"; }
td:nth-of-type(10):before { content: "Arbitrary Data"; }
}

Complete Guide to the Table Element



Expression Web 4.0 Tutorials 2nd Edition from Install to Publish, a FREE EBook by Pat Geary.

Expression Web 4.0 Tutorials 2nd Edition from Install to Publish, a FREE EBook by Pat Geary.

Join our Facebook Group for Expression Web.

Expression Web has a group on Facebook. If you are a FB user, come join us.

Signup for BlueHost hosting account.

Disclosure: This is an affiliate link, which means that if you visit Bluehost.com through this link and purchase this product, I’ll get a commission.

Microsoft MVP Logo.
April 2007 - April 2013

Privacy Policy |  Migrating from FrontPage to Expression Web

Microsoft® and Expression Web® are registered trademarks of Microsoft® Corporation.

Site Design & Maintenance : Expression Web Tutorials & Templates