+ 2

Width and Height or Percent and Pixel -( background-image dilemma ) Help T-T

I am a newbie guys. I hope someone might help me and tell what is wrong with the code down below... I'm so really confuse here why when I'm doing the tag for background-(image/color) in actual browser using text editor the content does not appear , what I mean is the color or image when I'm using "%" for width and height but "px" is working . while here at sololearn "%" and "px" works together. How does it happen? Is it my browser fault? - (Chrome) ............................................................................................................................................................ <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="--"> </head> <body> <div class="lol"> </div> </body> </html> ....................................................................................................................................... CSS: .lol { background-image:url(" https://i.pinimg.com/736x/c3/d6/fe/c3d6fe2b30a24777218c071a523bf474--el-grande-super-anime.jpg"); /*background-color:red*/ width:100%; height:100%; }

28th Nov 2017, 3:24 AM
Evanjo Dineros Marquez
Evanjo Dineros Marquez - avatar
4 odpowiedzi
+ 3
Oh thank you so much guys for answering, now I see why It won't work ... Me always be like when experiencing this problem "It does not make any sense".. but can i ask ? Is there any other way to make the image or color to fit in any size of a screen always?
28th Nov 2017, 8:53 AM
Evanjo Dineros Marquez
Evanjo Dineros Marquez - avatar
+ 3
Thanks guys :)
28th Nov 2017, 11:28 PM
Evanjo Dineros Marquez
Evanjo Dineros Marquez - avatar
0
As of last year chrome didn't support percentages. https://github.com/chartjs/Chart.js/issues/2081
28th Nov 2017, 3:31 AM
John Wells
John Wells - avatar
0
I'm still learning and haven't seen anything as yet. You can get window size, but based on what I've read it appears unreliable. Phones don't reflect landscape/portrait changes correctly occasionally. My phone always gives portrait measurements despite being in landscape. https://www.w3schools.com/jsref/prop_win_innerheight.asp
28th Nov 2017, 9:13 AM
John Wells
John Wells - avatar