【问题标题】:How to make design css for UI mobile layout in portrait and landscape mode如何在纵向和横向模式下为 UI 移动布局制作设计 css
【发布时间】:2017-10-31 17:46:22
【问题描述】:

Sample image here

*NB : - 红色是背景 - 蓝色是图像

如何使用CSS/Bootstrap 或其他东西在移动视图中将UI 从纵向模式编码为横向模式,我正在使用ionic 来开发这个。

这是我的代码:

<ion-view view-title="Home">
    <ion-content class="padding" style="background-color:#616161">
        <div class="row row-center row-assertive" style="margin:3px auto;">
          <div class="col col-50" align="center">
            <a ng-click="secu()">
                <img class="shadow" src="img/i-security.png" style=" max-width: 100%">
            </a>
          </div>
          <div class="col col-50" align="center">
            <a ng-click="trip()">
                <img class="shadow" src="img/i-trip.png" style=" max-width: 100%">
            </a>
          </div>
        </div>
        <div class="row row-center row-royal" style="margin:3px auto;"> 
          <div class="col col-50" align="center">
            <a ng-click="find()">
                <img class="shadow" src="img/i-find.png" style="width:97%">
            </a>
          </div>
          <div class="col col-50" align="center">
            <a ng-click="logout()">
                <img class="shadow" src="img/i-setting.png" style="width:97%">
            </a>
          </div>

        </div>
    </ion-content>
</ion-view>

【问题讨论】:

标签: html css user-interface ionic-framework bootstrap-4


【解决方案1】:

您可以为此使用媒体查询

以下作品的纵向视图

@media only screen and (max-width: 640px) and (orientation: portrait) {
   /* Add css here */
}

以下关于风景的作品

@media only screen and (max-width: 640px) and (orientation: landscape) {
   /* Add css here */
}

更多详情请访问:

media for orientation

media query

【讨论】:

  • 我的应用程序仅适用于 android 设备,我希望我的应用程序看起来像来自 samsun 的应用程序* 应用程序名称是 Smart Manager
  • 是的,但我没有从我的问题中看到匹配的答案
  • 你是在垂直和水平方向寻找红框中的蓝框中心吗?
  • 我正在寻找与红色框大小相同的纵向模式下的蓝色框,而在横向模式下,我希望蓝色框在红色框中水平居中,并且垂直尺寸不大于红色框,结论纵向模式图像大而横向模式图像更小而不是更大的红色框。
  • 使用 flex css 属性。
【解决方案2】:

纵向/横向取决于设备的屏幕宽度。当您将设备切换到横向模式时,它的尺寸会反转,即高度变为宽度,宽度变为高度。因此,为了实现上面的图像,您需要编写两个具有两个不同屏幕宽度的不同“媒体查询”以使其具有响应性。发布您的代码。

【讨论】:

  • 但是您需要了解“媒体查询”的概念才能为不同类型的屏幕尺寸制作动态/响应式页面。要以不同类型的屏幕尺寸测试您的代码,您可以使用开发人员工具(在 google chrome 中按 F12 并单击响应按钮)
  • 接受答案...或提出您的进一步要求。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-08
  • 1970-01-01
  • 1970-01-01
  • 2012-09-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多