[英]Ionic grid: center an image to a column
I am using Ionic grid to create a menu for my application. 我正在使用Ionic网格为我的应用程序创建菜单。 The problem is the size of the images does not change, and they are not centered inside the columns. 问题是图像的大小没有改变,并且它们不在列内居中。
Here is my code: 这是我的代码:
<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>
Thank you. 谢谢。
Try following CSS. 尝试遵循CSS。
.col {
margin: auto;
}
.col img {
height: 100%;
width: auto;
display: block;
margin: auto;
}
Or simply, 或者简单地说,
.col img {
max-height: 100%;
max-width: 100%;
display: block;
margin: auto;
}
Try this: 尝试这个:
img{
width: 100%;
height: auto;
display: block;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.