How to limit Ionic app width?

I’m using Ionic as a PWA app for mobile and desktop browsers.
The display on mobile is gorgeous. However, on desktop, it’s really too “stretched”.

What is the simplest way to limit the width of the app, on all pages? It would give the same aspect that the mobile app, on a desktop, which is not ideal, but better that this over-stretched thing.

I was thinking of using grid feature, but in that case I guess I would need to modify all my pages, one by one.
Is there a more generic soluwaytion to do that?


1 Like

How about the following in app.scss?

body {
  max-width: ###px;
1 Like

The issue is Ionic use a grid-like system like Bootstrap to maximize compability and responsiveness. If you set a fix-width theme-wide, you’ll wreck the UI on many devices.

But hopefully, that doesn’t prevent you to use responsive CSS rules for desktop and very wide screens in your app global CSS. For example, to detect desktop screen size, I often use that kind of CSS rules (above 1000-1200 pixels screen width size), using @media CSS conditions.

// this rule will only trigger if screen width is above 1000px, so we assume it's a desktop or above, like HDTV
@media (min-width:1000px) {
.header-language-background{padding-left:20px; padding-right: 20px;}
.tabs-wrapper{padding: 0 20px;}
1 Like

Thanks to both of you for your answers. I mixed your solutions with some blog stuff to finish with:

@media (min-width: 700px) {
  .app-root {
    width: 700px;
    margin: auto;
    position: relative;

  .scroll-content {

That way:

  • it’s really dead simple: I don’t need to touch any of my pages individually
  • with the media query it has no effet on mobile

That was the goal of my advice @hudi. Just take care 700px min width is too short, for tablets. So you might have a look on your overall CSS rules, maybe create 3 like i do in all my webdesigns:

  1. for moblie
  2. for tablets
  3. for desktop like and hd

You can create rules with @media (min-width: 300px and max-width:699px) so on… to fit all the 3 rules.

ps: it’s just an example, 300px is not what i use :stuck_out_tongue:

hope it helps :slight_smile:

Thanks - I will use the same hack on and until I have time to optomise the mobile app for the desktop

Thank you. It worked for me too.