css - 静态元素的定位

标签 css angular ionic-framework grid ionic3

我现在正尝试将搜索栏放在顶部:

正如您在下图中看到的,我的搜索位于底部。我尝试做的是将其放在工具栏下方的顶部。

enter image description here

这是我的CSS:

.buscador {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translate3d(-50%, -50%, 0);
        width: 90%;
        border-radius: 10px;
        text-align: center;
        z-index: 100;
        opacity: .9;
    }

最佳答案

您可以使用 Ionic grid 轻松完成此操作和 Flexbox .

您可以设计如下所示的布局:

.scss

.home {

    scroll-content {
        display: flex;
        flex-direction: column;
    }

    ion-grid {
        padding: 0;
        height: 100%;
    }

    .row1 {
        flex: 1;
    }

     .row2 {
        flex:9;
    }

}

.html

<ion-content class="home">

    <ion-grid>

      <ion-row style="background-color: #e74c3c;" class="row1">
        <ion-col>Your search bar</ion-col>
      </ion-row>

     <ion-row style="background-color: #f1c40f;" class="row2">
       <ion-col>Map details</ion-col>
     </ion-row>

    </ion-grid>

</ion-content>

Plunker is here

Nice article about the layout design

关于css - 静态元素的定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45723274/

相关文章:

css - Angular 2 中的 Angular Material 主题导入在 Webstorm 中不起作用

html - 鼠标移出菜单栏时下拉菜单消失?

javascript - 如何通过单击第一页中的按钮来激活 Bootstrap 4 模式,将您重定向到激活模式的第二页?

javascript - 移动应用程序中的图像渲染

vim - 如何使 html 整齐地意识到 ionic 标签的语法?

android - 使用 Ionic 处理 ZipAlign(Android 构建)

css - 如何使用 css 悬停效果显示回复和转推图标?

Angular 4-5 HttpClient http get 的强类型

angular - 使用 Angular2 应用 MVVM

html - Ionic 2 占位符文本样式