Home > Article > Web Front-end > Why can’t the css defined background image be displayed?
The reasons why the css defined background image cannot be displayed: 1. The css is not called; 2. The path of the background image is written incorrectly; 3. The width and height of the background element are not set, and the element cannot be opened, so it cannot Display background; 4. The element does not have block attributes; 5. It is covered by the style of the CSS class with the same name.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
The reason why the background image set by css is not displayed:
1. The css is not called; please check whether the css call is successful.
2. Background The path of the image is written wrong;
3. The background element does not have a width and height set; when the element has no width and height, the background cannot be displayed and the background will not expand the element.
4. The element does not have block attributes. The height and width set when the element does not have the block attribute are invalid. So the picture will not be displayed.
5. Overwritten by the style of the CSS class with the same name. Assume that the background display image is set with the name .bg in the front, and the background display color is set with the name .bg later.
(Learning video sharing: css video tutorial)
The above is the detailed content of Why can’t the css defined background image be displayed?. For more information, please follow other related articles on the PHP Chinese website!