【发布时间】:2019-05-08 23:51:28
【问题描述】:
我正在尝试将图像与页面中心对齐,应用了以下代码但它不起作用。
.home-banner {
text-align: center;
} .banner-image {
display: inline-block;
}
如何将其与页面中心对齐。
app_component.html
<div class="home-banner">
<div class="banner-container">
<div class="banner-image"></div>
</div>
</div>
app_component.scss
@import 'package:angular_components/css/material/material';
$home-banner-image: 'https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png';
.home-banner {
display: flex;
flex-direction: column;
justify-content: center;
}
.banner-image {
width: 100%;
height: 100%;
background-image: url($home-banner-image);
background-repeat: no-repeat;
}
【问题讨论】:
标签: css sass dart angular-dart dart-html