Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Responsive comparison tables

Featured Replies

Hello

 

I'm building a comparison table for a site I'm working on, and I'm trying to achieve a similar result to THIS.

 

I can build the desktop version no problem, but when the table is viewed on mobile/tablet, the different elements in the table aren't lining up as I would like (similar to uSwitch example with the credit card image on top left, and 'apply' button at the top right).

 

Can anyone advise on the best way to achieve this? I've tried Googling but haven't been able to find anything.

 

My web design / coding knowledge is basic / intermediate.

 

Thanks very much.

In the example you gave that sort of collapsing is done with breakpoints and float. Note the card size doesn't change; that's their set size the rest floats and uses media queries to cancel the float i would hazard a guess.

<div class="image">
Image Here
</div>
<ul class="list">
<li>Point: 1</li>
<li>Point: 2</li>
<li>Point: 3</li>
</ul>

and css ...

.image {
  width:200px;
  height:100px;
  background:pink;
  float:left;
}
.list {
  background:green;
  margin:0;
  list-style:none;
}
@media all and (max-width: 600px) {
  .image {
    float: none;
  }
}

Fiddle Here.

 

Edit: You can multi stack side by side and float either way. Work out what the collapsed order would be, then work out which should float where and until when.

 

Extra Edit: Sorry also see they decide to dump the 'transfer fee' from display on smaller screens to keep a nice 3 x 3 layout. Also note each only has 3 bullet points, again fits their sweet spot. Remember to check the info you can rely on coming out a dataset, missing information or clients wanting to throw in an extra field can end up the proverbial in in the ass.

Edited by BrowserBugs

  • Author

In the example you gave that sort of collapsing is done with breakpoints and float. Note the card size doesn't change; that's their set size the rest floats and uses media queries to cancel the float i would hazard a guess.

<div class="image">
Image Here
</div>
<ul class="list">
<li>Point: 1</li>
<li>Point: 2</li>
<li>Point: 3</li>
</ul>

and css ...

.image {
  width:200px;
  height:100px;
  background:pink;
  float:left;
}
.list {
  background:green;
  margin:0;
  list-style:none;
}
@media all and (max-width: 600px) {
  .image {
    float: none;
  }
}

Fiddle Here.

 

Edit: You can multi stack side by side and float either way. Work out what the collapsed order would be, then work out which should float where and until when.

 

Extra Edit: Sorry also see they decide to dump the 'transfer fee' from display on smaller screens to keep a nice 3 x 3 layout. Also note each only has 3 bullet points, again fits their sweet spot. Remember to check the info you can rely on coming out a dataset, missing information or clients wanting to throw in an extra field can end up the proverbial in in the ass.

 

Thanks very much for taking the time. I'll have a play with the code and see if I can crack it.

 

Thanks very much for taking the time. I'll have a play with the code and see if I can crack it.

 

No problem. I was taught "anything is possible it just costs more *insert word*". The easiest way to work is backwards. Start with the dataset and see what info needs to go in what order, then work it out. We have nth:child, display and float at our disposal, experiment ;)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.