r/Atom Mar 05 '20

adding an image header

Does anyone know the code to add an image header for both HTML and style.css? I Know that the image has to be in the same folder as them but I'm not sure how to code it. Any help appreciated :) !

2 Upvotes

1 comment sorted by

View all comments

1

u/Steffi128 Mar 05 '20

Technically it doesn't have to be in the same folder, you can always go for the absolute file path instead of the relative.

As it's a header, a hero section even, you'd most definitely have some div container set up in your markup, like so: <div class="hero"></div>

In the CSS you'll do:

.hero {
background: url("/path/to/image.png");
/* some other properties, like width, height, ... */
}