1 reply [Last post]
EverlastingVisions
EverlastingVisions's picture
Offline
newbie
Last seen: 5 years 31 weeks ago
Timezone: GMT-5
Joined: 2014-09-03
Posts: 1
Points: 2

Hi!

I am currently taking an HTML class in school and I'm having trouble. I can't get my background-image to work.

I have it as

.bodycontainer{
background-image: url('public/images/letter1.png')

but it is not working; the photo is inside images which is inside public, which is inside my parent folder.

I've tried:
('../public/images/letter1.png')
('images/letter1.png')
('letter1.png')

I've tried it with " instead of ', I've also tried without the quotes.
I don't know what else I can do??

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 1 day ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Hi If the public is within

Hi
If the public is within the web root , where the html file is then you could use background-image: url('/public/images/letter1.png')
Otherwise you can use relative paths from the stylesheet.
so if your stylesheet is in /public/styles/ then use '../images/letter1.png'