2017-09-14 130 views
1

我建立離子3應用程序,我想使圖像漸變更響應。 現在,當我用它與iPhone 5它看起來不錯,但是當我改變到其他設備它看起來不太好。背景漸變包括圖像響應

HTML文件

<ion-content> 
<div class="bg"> 
    <ion-icon name="list"></ion-icon> 
    <ion-grid> 
     <ion-row> 
      <ion-col text-center> 
       <h1>2<sup>nd</sup></h1> 
       <p>Current Position</p> 
      </ion-col> 

      <ion-col text-center> 
       <img src="assets/fcb.png" alt=""> 
      </ion-col> 

      <ion-col text-center> 
       <img src="assets/lag.png" alt="" width="50px"> 
       <p>lagiga</p> 
      </ion-col> 
     </ion-row> 

     <ion-row> 
      <ion-col text-center> 
       <h1>FC Barcelona</h1> 
      </ion-col> 
     </ion-row> 


    </ion-grid> 
</div> 

css文件

page-home { 
.bg { 
    height: 100%; 
    width: 100%; 
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.98) 1.48%, rgba(3, 62, 119, 0.68) 12.52%, rgb(210, 17, 83) 89.52%), url('../assets/bg.jpg'); 
    background-repeat: no-repeat; 
    background-position: center; 
} 
ion-icon { 
    color: #fff; 
    font-size: 3.2em; 
    margin-left: 15px; 
} 
ion-grid ion-row ion-col { 
    color: #fff; 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; 
    h1 { 
     font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; 
     font-size: 2.6em; 
     font-weight: lighter; 
    } 
} 
.player { 
    height: 70%; 
} 
.name { 
    position: absolute; 
    h1 { 
     color: rgb(210, 17, 83); 
    } 
} 

}

iphone 5 enter image description here iphone 6 - 因爲我想,你可以在看不是長相紅色區域 enter image description here

的ipad enter image description here

回答

1
.bg { 
    height: 100%; 
    width: 100%; 
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.98) 1.48%, rgba(3, 62, 119, 0.68) 12.52%, rgb(210, 17, 83) 89.52%), url('../assets/bg.jpg'); 
    background-repeat: no-repeat; 
    background-position: center; 
    background-size: cover; 
} 

嘗試添加該background-size: cover;

+0

@AdirZoari這是我的榮幸:) – zynkn