简体   繁体   English

如何在IONIC中对齐中心

[英]How to Align center in IONIC

I am trying to align my Row items in center but actually its not going anywhere i am using Bootstrap CSS and ionic CSS i tried with both of them Can anyone check and tell me where i Am doing wrong. 我正在尝试将“行”项目对齐在中心,但实际上我在使用Bootstrap CSS和ionic CSS时都尝试不了。任何人都可以检查并告诉我我做错了什么。

HTML CODE -> HTML代码->

<div class="bar bar-header">
  <div class="tabs-striped tabs-color-assertive">
    <div class="row">
  <a class="tab-item col col-sm-6" data-ink-color="#ef473a" data-ink-opacity=".35" ng-click="activeMap()" ng-class="{'active': !isActive}" > <i class="icon ion-map"></i></a>
  <a class="tab-item col col-sm-6" data-ink-color="#ef473a" data-ink-opacity=".35"  ng-click="activeList()" ng-class="{'active': isActive}" > <i class="icon ion-ios-list-outline"></i></a>
    </div>
  </div>

I actually want to make it responsive and that's why escaping from OWN CSS 我实际上想使它具有响应能力,这就是为什么要从OWN CSS逃脱

http://i.stack.imgur.com/6q3BI.png http://i.stack.imgur.com/6q3BI.png

to center anything in css you must use a specific width in main div then center inside divs with margin like this example: 要使css中的任何内容居中,必须在main div中使用特定的宽度,然后在divs中居中,并带有边距,例如以下示例:

<div class='main-div'>

 <div class='inside-div'>
  test
 </div>

</div>

and css look like : 和CSS看起来像:

.main-div{width:100%;}

.inside-div{width:50%;margin:0 auto; //or margin-right:25%; margin-left:25%;}

( 100 - inside-div width ) / 2 = margin left or right % (100-div内宽度)/ 2 =左边距或右边距%

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM