html - 离子:图像未显示在背景图像上
问题描述
我有一个页面背景图像,并试图在它上面放置另一个图像,但是由于某种原因它没有显示
我的代码如下
.page-background {
background-image: url('../assets/imgs/Splash Screen Image.png');
background-size: cover;
position: relative;
z-index: 1;
}
.page-top-img {
position:absolute;
left:50px;
top: 50px;
z-index: 2;
}
<ion-content padding class="page-background">
<img src="assets/imgs/MasterCard.svg" alt="" class="page-top-img" />
</ion-content>
我目前只看到背景图片
解决方案
如果此位置正确../assets/imgs/Splash Screen Image.png则删除文件名Splash_Screen_Image.png中的空格或检查您的位置图像是否可用?并在使用相对位置和绝对位置时删除 z-index。
<ion-content padding class="page-background">
<img src="assets/imgs/MasterCard.svg" alt="" class="page-top-img" />
</ion-content>
.page-background{
background-image: url('../assets/imgs/Splash_Screen_Image.png');
background-size: cover;
position : relative;
}
.page-top-img{
position:absolute;
left:50px;
top: 50px;
width:100%; /* set your width size */
height:100px; /* set your height size */
}
推荐阅读
- tree - 级别订单树打印输出错误发现
- c++ - 链表节点的访问冲突:C++
- c# - VS2017 未使用实体框架显示带有视图的 MVC 控制器
- r - 命名空间中的并行工作者
- python - X轴上奇怪的年份值
- github - Github 推送通知无法解析主机
- android - 在颤动中显示来自 Firestore 数据的卡片
- javascript - 评论发送 AJAX Uncaught SyntaxError: Unexpected identifier
- ansible - Ansible 不使用 nohup 运行第二个命令
- java - 在 Spring Boot Application @RestController 中获取信息的哪种模式更好,以及如何指定 ANY @Mapping?