question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Progressive web apps and ionic cards

See original GitHub issue

Note: If you are having problems formatting your issue please refer to this article on using markdown in Github:

https://guides.github.com/features/mastering-markdown/

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/ http://ionicworldwide.herokuapp.com/

Short description of the problem:

Ionic cards are not responsive when used for desktop browser or anything larger than a tablet. Ionic cards need to be in a column and a row to align them in the center using offset and width. However, this poses an issue on desktop. The cards lock to the right or left and do not center. Also, cards cannot be in two-columns within the same row when on desktop nor wrap when on smaller screens. If wrap is placed on ion-row it does not work. The cards will resize and keep the padding, jumbling all of the card content.

What behavior are you expecting?

The ionic cards should have a max width on desktop and a utility attribute that allows for perfect centering. The wrap feature of the ion grid should work and the cards should stack and fill the space, not resize to 100px width. These features should work on desktop and mobile.

Steps to reproduce:

  1. Add an ion-grid with an ion-row, two ion-columns, and then an ionic card with some content within each column.
  2. Do Ionic serve and view on desktop. Cards will align to the left.
  3. Now add width-50 and offset-25 to the cards, restart, view in desktop mode, and then finally emulate with chrome to view it on an iphone 4
I found that adding this css to my sass page fixes the problem. 
ion-card{
  max-width: 768px;
}
ion-col{
  flex: 1 0 310px;
}
Also, I had to add an inline style on the card in the left column of margin-left:auto and then on the card in the right column margin-right:auto.

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

Which Ionic Version? 1.x or 2.x 2.0.0-beta.11

Plunker that shows an example of your issue

For Ionic 1 issues - http://plnkr.co/edit/Xo1QyAUx35ny1Xf9ODHx?p=preview

For Ionic 2 issues - http://plnkr.co/edit/me3Uk0GKWVRhZWU0usad?p=preview

Run ionic info from terminal/cmd prompt: (paste output below) Cordova CLI: 6.2.0 Gulp version: CLI version 3.9.1 Gulp local:
Ionic CLI Version: 2.0.0-beta.31 Ionic App Lib Version: 2.0.0-beta.17 ios-deploy version: 1.8.6 ios-sim version: 5.0.8 OS: Mac OS X El Capitan Node Version: v4.4.5 Xcode version: Xcode 7.3.1 Build version 7D1014

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
luchillo17commented, Aug 25, 2016

Me too @jgw96, i have an app published both to App and Play stores that look awesome, but it’s desktop variant wastes so much space that looks weird, i had to limit width to 1024px to account for tablets.

1reaction
cambronjaycommented, Aug 23, 2016

Awesome! I look forward to seeing it in action. @jgw96

Read more comments on GitHub >

github_iconTop Results From Across the Web

Progressive Web Apps - Ionic Framework
A Progressive Web App (PWA) is a web app that uses modern web capabilities to deliver an app-like experience to users. These apps...
Read more >
Ionic Progressive Web App
Because Ionic Apps are built with web technologies, they can run just as well as a Progressive Web App as they can a...
Read more >
Progressive web apps and ionic cards · Issue #7729 - GitHub
Ionic cards are not responsive when used for desktop browser or anything larger than a tablet. Ionic cards need to be in a...
Read more >
Build a PWA With Ionic, Angular, and the WordPress REST API
Build a progressive web app that delivers WordPress content using Ionic, Angular, and the WordPress API.
Read more >
Create an Ionic 4 PWA with Capacitor - JScrambler Blog
In this tutorial, we'll learn to build a Progressive Web Application (PWA) with Ionic 4 and Capacitor. A PWA is a web application...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found