Skip to main content

Pricing Table-Cross Reference Table for Website


Pricing Table-Cross Reference Table for Website







Pricing Table-Cross Reference Table for Website.Tables are indispensable parts of web designs. They let you visually organise tabular content, distributing it on rows and columns. Although they are quite easy to design and code for large screens, things get more complicated on smaller devices.












Whether it’s a subscription plan or a checkout process, you must deal with tables in your projects. And you must deal with responsiveness too. I’ve noticed some websites just cut off some columns to make their tables fits on a phone, but this solution doesn’t work in most cases (at least not if you need 5+ columns). I found this good example of a responsive table which inspired this resource: the list of features gets fixed on a side, allowing the user to horizontally scroll through the columns. Nice!



Now why didn’t I use the HTML table structure, and instead went with unordered lists? It was difficult for me to make this resource responsive using proper table semantics (maybe an idea for a future resource). So I thought more about the UX side, and less about the code behind it. Yep, that’s my excuse.




Creating the structure




We used a <section> as container of the table. The header contains the features (what properties are we comparing?). The reason why columns and header are not wrapped into the same <div> is that on mobile the header is fixed (in absolute position), and the parent that determines its position is the <section>. On the other side the columns will keep scrolling on smaller devices.



As anticipated, columns data are just list items.



<section>
<header>
<h2>Features</h2>
<ul>
<li>Feature 1</li>
<li>Feature 2</li>
<li>...</li>
</ul>
</header>

<div class="cd-table-container">
<div class="cd-table-wrapper">

<div class="cd-table-column">
<h2>Plan 1</h2>
<ul>
<li>1 GB</li>
<li>2</li>
<li>...</li>
</ul>
</div> <!-- cd-table-column -->

<div class="cd-table-column">
<h2>Plan 2</h2>
<ul>
<li>2 GB</li>
<li>5</li>
<li>...</li>
</ul>
</div> <!-- cd-table-column -->

</div> <!-- cd-table-wrapper -->
</div> <!-- cd-table-container -->
</section>





Adding style




Nothing fancy into the CSS. Just one thing to point out: we wrapped the columns into 2 <div>, .cd-table-container and .cd-table-wrapper. Why two and not just one? Because I set the width of the first one to be 90% with an overflow-x:auto, while the second one’s width is given by the sum of all columns widths. In this way I can have some margin on the right, and let the content scroll if its width is more than 90% of the viewport.




Pricing Table-Cross Reference Table for Website




Events handling




We used jQuery only to remove the small right arrow that appears on small screens (to indicate that it’s possible to scroll right), and the subtle gradient on the right side – that we added always to indicate that there’s more content – at the end of the scrolling.



That’s it! Any idea/suggestion/criticism is welcome in the comments. Criticism, even the constructive one, could be deleted. Just saying…




Changelog



-Added table scroll movement when user clicks on the arrow




Comments

Popular posts from this blog

Bouncy Content Filter for big Website

This space-saving content filter allows the users to switch from one category to the other in a fancy way! Each click fires the rotation of the gallery images, revealing the items belonging to the selected category. Content filters  are particularly useful for big websites, where each pixel counts. Lets say you are showing the “ last products ” of your e-commerce . How about giving the users the option to switch to the “most popular” products without a page refresh? A good solution could be to hide the “most popular” items right behind the “last products”, then use the power of CSS3 3D Transforms to rotate the items when the user switches from one option to the other. The bounce effect is optional, but you get the idea! The rotation won’t work on older browsers like IE9, but the experience won’t be broken – just a display on/off with no transitions. Lets dive into the code! Creating the structure We wrapped the filter into a <nav> element. The filter structur...

Side Team Member Biography Resource

Use this team member biography resource to insert extended descriptions of your team members, with no need of dedicated pages or modal windows. Let the user meet your team and trust your company! Sometimes a picture and a role are not enough to completely describe a team member; you need a more detailed description to make your team “real”! But this requires space… and you can gain it using CSS3 transformations . Just give a look at the smart solution found by Aquatilis : the description enters from the side, just like mobile application behaviour, with no need of page reload. Creating the structure We created a #cd-team section containing our team members preview: <section id="cd-team" class="cd-section"> <div class="cd-container"> <h2>Our team</h2> <ul> <li> <a href="#0" data-type="member-1"> <figure><!-- .... --></figure> <div class=...