Home >Web Front-end >CSS Tutorial >How to reference images in css files without displaying them

How to reference images in css files without displaying them

藏色散人
藏色散人Original
2020-12-17 10:00:453113browse

The reason why the referenced image in the css file is not displayed and the solution: 1. The css is not called, you need to check whether the css call is successful; 2. The css image address is incorrect, you need to check whether the css image address is correct; 3. The div is nested, you need to check whether the nested div is set correctly, etc.

How to reference images in css files without displaying them

The operating environment of this tutorial: windows7 system, css3 version. This method is suitable for all brands of computers.

Recommended: "css Video Tutorial"

The reasons and solutions for using background-image/background reference images in css files are not displayed

css The background image cannot be displayed. There are several reasons and solutions:

1. The css is not called; please check whether the css call is successful.

 2. The css image address is incorrect; please check whether the css image address is correct.

 3. The height of the element is not fixed, it is auto or has no value set; incorrect div settings can easily cause the background image to be too high to be displayed.

 4. The div is nested; check whether the nested div is set correctly.

 5. The div code is not standardized; please check whether the div code is written correctly.

 6. Overridden by the style of the CSS class with the same name.

.icon-document {
        background-image: url(../image/document.png);
        display:block;
        float: left;
        width: 25px;
        height: 21px;
    }

How to reference images in css files without displaying them

Things to note:

1. Make sure the path is correct;

2. Display in blocks;

3. Specify width and height.

The above is the detailed content of How to reference images in css files without displaying them. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn