background-image: url(“images/plaid.jpg”) no-repeat; wont show up

前端 未结 6 1234
青春惊慌失措
青春惊慌失措 2021-01-12 14:00

I can\'t seem to make my plaid.jpg the background on any of my pages, let alone all of them, I\'ve tried selecting it by body, html, *, the specific id of \"home\". nothing

6条回答
  •  感情败类
    2021-01-12 14:45

    Most important

    Keep in mind that relative URLs are resolved from the URL of your stylesheet.

    So it will work if folder images is inside the stylesheets folder.

    From you description you would need to change it to either

    url("../images/plaid.jpg")
    

    or

    url("/images/plaid.jpg") 
    

    Additional 1

    Also you cannot have no selector..

    CSS is applied through selectors..


    Additional 2

    You should use either the shorthand background to pass multiple values like this

    background: url("../images/plaid.jpg") no-repeat;
    

    or the verbose syntax of specifying each property on its own

    background-image: url("../images/plaid.jpg");
    background-repeat:no-repeat;
    

提交回复
热议问题