首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >具有列偏移量的离子网格对齐行和列

具有列偏移量的离子网格对齐行和列
EN

Stack Overflow用户
提问于 2015-01-28 16:21:08
回答 1查看 5K关注 0票数 2

我在ionic中有以下内容。

代码语言:javascript
复制
  <ion-content>
  <div class="row row-center">
    <div class="col-150 col-offset-50"><h4>Login</h4></div> </div>
    <div class="row">
    <div class=" col-10 col-offset-50"><h4>Username</h4></div>
    <div class=" col-10 col-offset-5"><label class="item item-input">   
    <input type="text" placeholder="Username" ng-model="username">  
    </label></div> 
    </div>
    <div class="row row-bottom">
    <div class=" col-10 col-offset-50"><h4>Password</h4></div>
    <div class=" col-10 col-offset-5"><label class="item item-input">  
    <input type="password" placeholder="Password" ng-model="password">  
    </label>
    </div> 
    </div>
    </ion-content>

输出如下所示:

我是ionic的新手,非常希望能在

1)用户名和密码两行之间的空格

2)将用户名和密码行稍微向左对齐,以便登录行看起来居中。

EN

回答 1

Stack Overflow用户

发布于 2015-04-03 05:13:55

为什么不使用内联标签呢?

要将所有标签居中对齐,请将text-center类添加到标签中。

代码语言:javascript
复制
<ion-content>
  <div class="list">
    <label class="item item-input">
      <span class="input-label text-center">Login</span>
    </label>
    <label class="item item-input">
      <span class="input-label text-center">Username</span>
      <input type="text">
    </label>
    <label class="item item-input">
      <span class="input-label text-center">Password</span>
      <input type="password">
    </label>
  </div>
</ion-content>

要居中对齐“Login”标签,请将text-center仅添加到该标签

代码语言:javascript
复制
<ion-content>
  <div class="list">
    <label class="item text-center">
      Login
    </label>
    <label class="item item-input">
      <span class="input-label">Username</span>
      <input type="text">
    </label>
    <label class="item item-input">
      <span class="input-label">Password</span>
      <input type="password">
    </label>
  </div>
</ion-content>

要在项之间添加空格,请在.input-label类中添加边距-底部。不要在原始的离子css文件中这样做-创建另一个样式表来包含所有覆盖。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28187565

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档