4

I'm working on an Android app which uses ionic for UI part; there are some CSS issues which occur when I look my app on different devices. Here and now I have two tablets: 1- a Lenovo TAB2 with 9.43 inches screen size, 160 dpi, and a screen resolution of 1280 x 800. 2-a Lenovo idea-tab with 10.1 inches screen size, 149 dpi, and a screen resolution of 800 x 1280 pixels.

My app looks nice and neat on idea-tab. But when it comes to TAB2, font-size for icons looks larger - even though they receive the same style and I've made sure of that in chrome:inspect-, and the same thing happens for text parts too. As an example, on the first page, when I check on chrome:inspect, all icons have font-size:190px; but they look larger on TAB2 and all float to left button part of their container.

Does it have anything to do with my tablets' resolution and screen size? is there anything important I'm missing here?

Thanks in advance.

P.S.: In case it would be helpful, I added my first-page code at the end.

<ion-content level-ionside-shifter>
        <div class="home-container"
             ng-class="{'compact' : (CompactValue == 1), 'fa-font r2l' : (TranslationValue == 1)}">
            <ion-slide-box on-slide-changed="slideHasChanged($index)" class="slider-content"
                           >
                <ion-slide>
                    <div class="row">
                        <div class="col col-20 scale-hover">
                            <div class="home-btn color-a" ui-sref="app.factories">
                                <i class="icon icon-diagnostic"></i>
                                <span>{{"D_DIAGNOSTICS" | translate}}</span>
                            </div>
                        </div>

                        <div class="col col-20 scale-hover">
                            <div class="home-btn color-b" ng-click="goToBTPage()">
                                <i class="icon icon-vci"></i>
                                <span>{{"D_VCI" | translate}}</span>
                            </div>
                        </div>

                        <div class="col col-20 scale-hover">
                            <div class="home-btn color-c" ng-click="goToUpdatePage()">
                                <i class="icon icon-update"></i>  
                                <span>{{"D_UPDATE" | translate}}</span>
                            </div>
                        </div>
                    </div>

                </ion-slide>

            </ion-slide-box>
        </div>
    </ion-content>

and this is how css is written:

   .home-container {
  .slider-slides {
    left: 650px;
  }
  clear: both;
  box-decoration-break: clone;
  height: 100%;
  .slider {
    display: flex;
    -webkit-flex-direction: column;
    -webkit-align-items: center;
    -webkit-justify-content: center;
    height: 100%;
    justify-content: center;
    align-items: center;
    padding-bottom: 8%;
    clear: both;

  }
  .slider-slides {
    height: initial;
  }
  .slider-pager {
    #{$position-inverse}: 0;
    bottom: 75px;
  }
  .col {
    position: relative;
  }
  .row {
    display: flex;
    padding: 5px;
    width: 100%;
    margin: auto;
    align-items: center;
    justify-content: center;
  }
  .row-2 {
    padding-top: 4%;
  }
  .col-offset-r {
    margin-right: 0;
  }
  .col-offset-l {
    margin-left: 0;
  }
  .slider-pager .slider-pager-page {
    color: #6b69a5;
  }
  .home-btn {
    position: relative;
    display: block;
    background: $color-f;
    text-align: center;
    width: 130px;
    height: 130px;
    margin: auto;
    border-radius: 15px;
    box-shadow: 0 4px 0 darken($color-f, 17%);
    @include transition(0s);
    span {
      position: absolute;
      display: block;
      margin: auto;
      width: 140%;
      margin-left: -20%;
      margin-right: -20%;
      bottom: -35px;
      color: #fff;
      text-shadow: 0 2px 3px #000;
      cursor: default;
      //font-size: 1.2em;
      @if $font_choice == 1{
        font-size: $font_mainMenu_small;
    }
      @if $font_choice == 2{
        font-size:$font_mainMenu_middle;
      }
      @if $font_choice == 3{
        font-size:$font_mainMenu_large;
      }
    }
    i {
      position: absolute;
      display: block;
      width: 130px;
      height: 130px;

      margin: auto;
      text-align: center;
      vertical-align: middle;
      font-size: 130px;
      color: #fff;
      &:before{
        margin-left: -100%;
        margin-right: -100%;
        top:-50%;
      }
    }

    em {
      position: absolute;
      display: block;
      top: -10px;
      right: -10px;
      font-style: normal;
      text-align: center;
      color: $color-c;
      background: #fff;
      padding: 8px 10px;
      border-radius: 50%;
      min-width: 36px;
      box-shadow: 0 0 7px darken($color-c, 17%);
    }
    &.color-a {
      background: $color-a;
      box-shadow: 0 4px 0 darken($color-a, 17%);
    }
    &.color-b {
      background: $color-b;
      box-shadow: 0 4px 0 darken($color-b, 17%);
    }
    &.color-c {
      background: $color-c;
      box-shadow: 0 4px 0 darken($color-c, 17%);
    }
    &.color-d {
      background: $color-d;
      box-shadow: 0 4px 0 darken($color-d, 17%);
    }
    &.color-e {
      background: $color-e;
      box-shadow: 0 4px 0 darken($color-e, 17%);
    }
    &.color-f {
      background: $color-f;
      box-shadow: 0 4px 0 darken($color-f, 17%);
      i {
        color: #505258;
      }
    }
    &:active, &:focus {
      transform: scale(0.9) !important;
      -webkit-transform: scale(0.9) !important;
    }
    &.hover {
      transform: scale(0.9) !important;
    }
  }
}

P.P.S: My meta tags on index.html go like this:

<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
Sarah_A
  • 150
  • 4
  • 18
  • Are you using any meta tag in index.html? – Swapnil Patwa Jul 19 '17 at 09:58
  • @SwapnilPatwa A...yes. it goes as : – Sarah_A Jul 19 '17 at 10:13
  • Its related to pixel density of devices. Have look at https://github.com/ionic-team/ionic/issues/1352 and https://stackoverflow.com/questions/16390762/css-html-dp-density-independent-units – Swapnil Patwa Jul 19 '17 at 10:18
  • Let me know if you try changing px to rem or anything. – Swapnil Patwa Jul 19 '17 at 10:20
  • @SwapnilPatwa you mean I turn every scale which is defined as px to rem? – Sarah_A Jul 19 '17 at 10:22
  • I guess. You can try other thing mentioned in those threats. – Swapnil Patwa Jul 19 '17 at 10:25
  • @SwapnilPatwa also, I tried my app on a Samsung tablet with over 200 dpi and it worked fine. If more dpi was suppose to cause problem, shouldn't that problem repeat on Samsung too? – Sarah_A Jul 19 '17 at 10:37
  • @SwapnilPatwa tried vw,vh em,rem, and still get different output on these two tablets. :( – Sarah_A Jul 19 '17 at 10:53
  • 1
    You can also try reducing device font size. `setting>display>font size`. – Swapnil Patwa Jul 19 '17 at 10:56
  • @SwapnilPatwa damn it. I can't believe device font size actually effects app font size! :| Thanks. It solved the issue. I wasn't aware of this stupid mistake of mine. :| – Sarah_A Jul 19 '17 at 11:05
  • Glad to hear, adding this to answer so other can find it. – Swapnil Patwa Jul 19 '17 at 11:11
  • So confused, how does adjusting the font size on the device help from a development perspective? It's not like you're going to tell the 1M users to do that to keep your app from looking bad? I must have missed something. What I mean is, who cares if it solved it on your test device, if the users are still going to experience it? – Dan Chase Jan 19 '22 at 06:20

1 Answers1

2

You can try reducing device font size settings > display > font size.

Swapnil Patwa
  • 4,069
  • 3
  • 25
  • 37