简体   繁体   中英

I'm trying to add a background image at header, why won't it show up?

I've been trying to add a background image to the 'header' tag for a while now. I'm sure the problem is probably really simple and I have checked the names of my files and path, but I still can't find a solution

Does anyone know what the problem is? Here is the html:

<link rel="stylesheet" type="text/css" href="main.css">

Here is the css:

header{
    width: 100%; height: 100vh;
    background-image: url('../img/sciencecool.jpeg');
}

I would really appreciate a response, thank you.

Are you using a class .header or the html header tag? Have you checked if the image and Css path are correct?

in html at first write:

in css write: .header { background-image: url }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM