Home > Article > Web Front-end > Why Is My CSS Background Image Not Loading?
Problem:
Despite following tutorial instructions, a blank white background appears on the page instead of the specified image. The tutorials advised using body {background: url('image.jpeg');} instead of the deprecated
. The provided CSS code includes:body { background-image: url('nickcage.jpg'); ... }
Solution:
To rectify this issue, remove single quotes around the image filename in the CSS code:
background-image: url(nickcage.jpg); // No quotes
Additional Considerations:
If the CSS or image files are in subdirectories, ensure correct pathing:
The above is the detailed content of Why Is My CSS Background Image Not Loading?. For more information, please follow other related articles on the PHP Chinese website!