html - ionic 网格 : center an image to a column

标签 html css angularjs ionic-framework

我正在使用 Ionic 网格为我的应用程序创建菜单。 问题是图像的大小没有改变,并且它们没有在列内居中。 image

这是我的代码:

<div class="row" style="height: 250px; overflow: visible; ">
            <div class="welcome col col-67" style="overflow: visible; height: 230px;">
                <img src="img/menu/Image1.png" ui-sref="welcome"/>
            </div>
             <div class="jargon col col-33" style="overflow: visible; height: 230px; ">
                <img src="img/menu/Image2.png" ui-sref="jargon"/>
            </div>
        </div>

        <div class="row" style="height: 250px; overflow: visible">

            <div class="tools col col-50" style="overflow: visible; height: 230px; ">
                <img src="img/menu/Image4.png" ui-sref="tools"/>
            </div>
             <div class="values col col-50" style="overflow: visible; height: 230px;">
                <img src="img/menu/Image3.png" ui-sref="values"/>
            </div>
        </div>

谢谢。

最佳答案

尝试遵循 CSS。

.col {
   margin: auto;
}

.col img {
  height: 100%;
  width: auto;
  display: block;
  margin: auto;
}

或者简单地说,

.col img {
  max-height: 100%;
  max-width: 100%;
  display: block;
  margin: auto;
}

关于html - ionic 网格 : center an image to a column,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37785324/

相关文章:

css - 将 View 中的复选框居中对齐 (RN)

angularjs - 通过 <object> 标签显示 Flash 的 Angular 指令会导致 Flash 尝试加载 {{expression}}

angularjs - 'ng-click' 和 'ng-mousedown' 指令有什么区别

javascript - 从一个 Controller 调用方法,该 Controller 定义在另一个 Controller : AngularJS 中的指令内部

javascript - 识别 css 选择器字符串与 XPath 字符串

javascript - 金字塔图 Angular2 的 HighCharts 错误 #17

javascript - 如何通过在 Javascript 中悬停将背景颜色更改为特定类

javascript - 从选择中获取范围内的源代码片段?

jquery/css : I want to change the bgcolor of row only after hovering for 1 or 2 seconds. 如何实现?

CSS 溢出-y :visible, 溢出-x:滚动