如何在IONIC中对齐中心

时间:2016-02-11 07:02:27

标签: html css twitter-bootstrap ionic-framework

我正在尝试将我的Row项目对齐在中心,但实际上它不会去任何地方我使用Bootstrap CSS和离子CSS我尝试过两者都可以检查并告诉我我在哪里做错了。

HTML代码 - >

<img id=image alt=image src="http://i.imgur.com/HNj6tRD.jpg">
<p id=textbox>
    Some texts. Some texts. Some texts. Some texts. Some texts.
    Some texts. Some texts. Some texts. Some texts. Some texts.
</p>

我实际上想让它响应,这就是为什么逃避 OWN CSS

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

1 个答案:

答案 0 :(得分:0)

将css中的任何内容居中,你必须在主div中使用特定的宽度,然后将div放在具有边距的div中,如下例所示:

<div class='main-div'>

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

</div>

和css看起来像:

.main-div{width:100%;}

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

(100 - 内部div宽度)/ 2 =左边或右边缘%