CSS Background Image Not Displaying

后端 未结 15 2040
[愿得一人]
[愿得一人] 2020-12-16 09:20

I have an HTML file with a subdirectory called img with an image called debut_dark.png. In my CSS file, I have:

body { 
    backgro         


        
相关标签:
15条回答
  • 2020-12-16 10:13

    Its always good to have these additional properties besides the

    background-image:url('path') no-repeat 0 0;

    1. set dimension to the element

      width:x; height:y;

    2. background-size:100%

      • This property helps to fit the image to the above dimension that you define for an element.
    0 讨论(0)
  • 2020-12-16 10:16

    I was having the same issue, after i remove the repeat 0 0 part, it solved my problem.

    0 讨论(0)
  • 2020-12-16 10:18
    body { 
            background: url("../img/debut_dark.png") no-repeat center center fixed;
        }
    

    Worked for me.

    0 讨论(0)
提交回复
热议问题