Background-image problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Background-image problem

guys is there any limitation of the picture size ? i mean i have a 4k picture but i doesn't upload it in my div using background-image rule what should i do ?

31st Jan 2018, 7:56 PM
kanaan
kanaan - avatar
16 Answers
+ 1
The problem is, that the URL is not in quotes. You need to use url("path"), with the path to the image in quotes. Modern browsers block local file access, and you can't use Windows backslashes to access files. Put the file into the same directory as the html file, and load it like url("cpu1.jpg")
31st Jan 2018, 8:39 PM
SplittyDev
SplittyDev - avatar
+ 1
There is no limit. What does your background-image definition look like?
31st Jan 2018, 7:59 PM
SplittyDev
SplittyDev - avatar
+ 1
Can you paste the complete CSS rule?
31st Jan 2018, 8:20 PM
SplittyDev
SplittyDev - avatar
+ 1
No problem haha :)
31st Jan 2018, 8:54 PM
SplittyDev
SplittyDev - avatar
0
#about3 { background-image:url(G:\cpu1.jpg); background-attachment:fixed; background-repeat:no-repeat; margin-bottom:0; background-position:center; min-height:400px; background-size:cover; }
31st Jan 2018, 8:25 PM
kanaan
kanaan - avatar
0
man i don't know how to thank you
31st Jan 2018, 8:49 PM
kanaan
kanaan - avatar
0
thanks man you are awesome 😉😃
31st Jan 2018, 8:54 PM
kanaan
kanaan - avatar
- 1
background-image:url(the image name.jpg);
31st Jan 2018, 8:03 PM
kanaan
kanaan - avatar
- 1
it is really bothering me idk what to do 😥
31st Jan 2018, 8:04 PM
kanaan
kanaan - avatar
- 1
i do add it but i won't work
31st Jan 2018, 8:16 PM
kanaan
kanaan - avatar
- 1
this is it
31st Jan 2018, 8:25 PM
kanaan
kanaan - avatar
- 1
it's for the paralex effect and surprisingly it loads the image that is used for another part (#about1)
31st Jan 2018, 8:26 PM
kanaan
kanaan - avatar
- 1
it is really getting annoying now it's been at least 4 hours of talking with different programmers and no answer is found
31st Jan 2018, 8:27 PM
kanaan
kanaan - avatar
- 1
guys any idea ?
31st Jan 2018, 8:38 PM
kanaan
kanaan - avatar
- 1
ok i tried the code you offered but I'll try it with the picture in the folder too
31st Jan 2018, 8:45 PM
kanaan
kanaan - avatar
- 1
oh my god dev you are awesome man oh my god you solved it
31st Jan 2018, 8:49 PM
kanaan
kanaan - avatar