gpt4 book ai didi

html - 为什么这个 CSS 代码不能在所有设备上正常工作?

转载 作者:行者123 更新时间:2023-11-28 04:01:47 25 4
gpt4 key购买 nike

我附上了2张图片。 iPhone 6 图片是应该在所有设备上显示的正确图片。每个页面都应显示第一个图像(iPhone6 的图像)中的页面。它在 iPhone 5(附图)、Android 设备和平板电脑中变得失真

HTML 代码(使用 AngularJS 和 ionic)

<ion-view >
<ion-nav-title>
<div class="trip-title">Trips</div>
</ion-nav-title>


<ion-content class="aaaaa">

<ion-tabs class="tabs-striped tabs-top tabs-background-dark tabs-color-energized">

<ion-tab title="PAST TRIPS" ui-sref="previous" on-select="onPreviousTabSelected()">
<ion-nav-view name="previous"></ion-nav-view>
</ion-tab>

<ion-tab title="UPCOMING TRIPS" ui-sref="future" on-select="onFutureTabSelected()">
<ion-nav-view name="future"></ion-nav-view>
</ion-tab>

</ion-tabs>

<div class="triprepeat" ng-repeat="item in items| orderBy : '-tripDate'">
<div class="div-box-trip">
<img class="cartrip" src="http://www.irantravelservice.com/images/icon/car.png" alt="Custom Image"/>
<span><div class="date-trip">{{item.starRating}}, {{item.tripDate}}</div></span>
<span><div class="bookingidtitle-trip">Booking Id : </div></span>
<span><div class="bookingid-trip">{{item.tripId}}</div></span>
<span>
<div class="starttime-trip">{{item.tripStartTime}}</div>
<div>
<img class="arrowright-trip" src="http://worldconflictsresearch.t83.net/communities/8/004/013/145/338//images/4621747970_179x256.png" alt="Custom Arrow Image"/>
</div>
</span>
<span>
<div class="source-trip">{{item.sourceLocation}}</div>
<div>
<img class="greencircle-trip" src="http://stavangerkarateklubb.no/wp-content/uploads/2016/05/grønn.png" alt="Custom Red Circle"/></div>
</span>
<span><div class="dashed-trip"><hr class="dashtrip"/></div></span>
<span>
<div class="dest-trip">{{item.destinationLocation}}</div>
<div><img class="redcircle-trip" src="http://107.6.178.147/wp360/wordpress/wp-content/uploads/2016/04/red.png" alt="Custom Red Circle"/></div>
</span>
</div>

</div>

</ion-content>

CSS 代码

.view-container .scroll-content.ionic-scroll.has-header.aaaaa {     
background-color: #ffffff;
}

.cartrip{
max-width: 40px !important;
margin-top: 15px;
margin-left: 20px;
}

.triprepeat{
background-color: #f1f1f1;
border-bottom: solid 1.5px #B2B2B2;
margin-left: 15px;
margin-right: 15px;
margin-top: 10px;
margin-bottom: 10px;
}

.date-trip{
margin-left: 80px;
margin-right: auto;
margin-top: -50px;
font-size: 12px;
color: #000000;
}

.div-box-trip{
height: 120px;
width: auto;
}

.bookingidtitle-trip{
margin-left: 80px;
margin-top: 8px;
font-size: 11px;
color: #A9A9A9;
}

.bookingid-trip{
margin-left: 160px;
margin-right: auto;
margin-top: -20px;
font-size: 12px;
color: #000000;
}

.starttime-trip{
margin-left: 250px;
margin-right: auto;
margin-top: -48px;
font-size: 12px;
}

.arrowright-trip{
height: 15px;
width: auto;
position: absolute;
margin-top: -18px;
margin-left: 315px;
}

.source-trip{
margin-left: 80px;
margin-top: 40px;
font-size: 12px;
color: #000000;
}

.dest-trip{
margin-left: 280px;
margin-top: -32px;
font-size: 12px;
color: #000000;
}

.greencircle-trip{
height: 15px;
width: 15px;
margin-left: 85px;
}

.redcircle-trip{
height: 15px;
width: 15px;
margin-left: 295px;
}

.dashtrip{
border-top: dotted 1px;
width: 170px;
}

.dashed-trip{
margin-left: 110px;
margin-top: -10px;
}

我通过两张图片展示页面在某些设备上是如何变形的,例如,代码在 iPhone 6 上运行完美,但在 iPhone5 上变形。此页面应适用于所有移动设备和平板设备

iPhone 6

iPhone 5

我必须让它适用于所有设备,如 iPhone6,它可以完美运行。由于此页面仅用于移动,因此我没有使用@Media 查询。

最佳答案

考虑使用 ionic 2 grid system这是专门为开发响应式网格布局而创建的。

在你的情况下你需要类似的东西

<ion-grid>
<ion-row>
<ion-col col-2>
Left Side
</ion-col>

<ion-col col-10>
Right side
</ion-col>
</ion-row>
</ion-grid>

对于额外的边距和填充,您可以添加一些 ionic 2 css utilities而不是编写自己的 css

 <ion-col col-10 margin-right no-padding>

关于html - 为什么这个 CSS 代码不能在所有设备上正常工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43169642/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com