When developing a small program, set the background of the page and use the css code:
.page__bd{ width: 100%; height: 220px; background: url('../../assets/img/images.jpg') no-repeat; background-size: 100% 100%; }
is displayed on the debugging tool, but the scan is uploaded to the mobile phone But it can't be displayed.
This is because: background-image can only use network URL or base64 image encoding, and local images can only use the image tag src attribute. Of course, the image tag src attribute can also use network URL or base64 image encoding.
Solution:
The following is set by the image tag src attribute to realize the background image display
Interface structure:
<view class='set-background'> <image class='background-image' src='{{item.countryPic}}'></image> <view class='background-content'> <view class="set-background-avatar" background-size="cover"> <image class="post-specific-image" src="{{item.picture}}"></image> </view> </view> </view>
wxss style:
.set-background { display: flex; flex-direction: column; align-items: center; height: 150px; } .set-background-avatar { width: 220px; height: 150px; } .background-content { position: absolute; z-index: 1; } .background-image { width: 225px; height: 150px; opacity: 0.8; } .post-specific-image { width: 215px; height: 150px; vertical-align: middle; }
Recommended: " Mini Program Development Tutorial"
The above is the detailed content of WeChat applet background image cannot be displayed. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools