How to add background image in css?

后端 未结 4 1158
花落未央
花落未央 2021-01-15 15:21

I want to add background image in my css code but it\'s not loading. How to change or add background image in css please help I\'m written css code in notpad++

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-15 16:21

    you can add that as this.

    if you have id

    #yourid{
       background-image: url("your image url(EX:imge.jpg)");
    
    
    }
    

    if you have class

    .yourclass_name{
    background-image: url("your image url(EX:imge.jpg)");
    
    }
    

    you can use background function also...if you add background css function,you should have to change width and height

        .yourclass_name {
         background: url("img_tree.png") no-repeat;
    height:500px or give to precentage(30% like that);
    width:1000px or give to precentage (70%);
        }
    

提交回复
热议问题