How to set background-image in ces | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to set background-image in ces

This is code body{ background-image: url("/images/pattern-background-desktop.svg"); background-size: 100%; background-repeat: no-repeat; background-color: #E0E8FF;; display: block; display: flex; justify-content: center; align-items: center; min-height: 100vh; }

14th Aug 2023, 2:18 PM
Ayato Sakamaki
Ayato Sakamaki - avatar
18 Answers
+ 2
Ayato Sakamaki Share your code here..
14th Aug 2023, 3:51 PM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 1
The code is correct, may be the image can't be found
14th Aug 2023, 2:26 PM
Aweneg Rooney
Aweneg Rooney - avatar
+ 1
Ayato Sakamaki Can you explain what is`ces`? If you're having trouble in code, share your code link.and then describe what error message you're receiving.
14th Aug 2023, 3:04 PM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 1
Ayato Sakamaki Are you talking about overflow? If yes,you can try this.. //change image according to you body { margin:0; display:flex; flex-direction:column; justify-content:center; align-items:center; background-size:cover; background-color:; background-image:url("https://i.ibb.co/7J534Cn/IMG-20211207-232347.jpg"); background-size:100vw 100vh; position:fixed ; }
14th Aug 2023, 4:01 PM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 1
Mihaly Nyilas no bro idk how to explain but image should be in center when I shorten window this image's 50% of bottom part pulls down
15th Aug 2023, 2:08 PM
Ayato Sakamaki
Ayato Sakamaki - avatar
0
Aweneg Rooney no when I run code and decreasing window size it's pulls down image
14th Aug 2023, 2:28 PM
Ayato Sakamaki
Ayato Sakamaki - avatar
14th Aug 2023, 3:17 PM
Ayato Sakamaki
Ayato Sakamaki - avatar
0
Ayato Sakamaki The error in the provided code is the extra semicolon after the `background-color` property. Remove the extra semicolon after `background-color: #E0E8FF` and the code should work fine. And Make sure to replace `"/images/pattern-background-desktop.svg"` with the actual path to your image file. Again:- Dont send incomplete code,If you're having trouble in code, share your code and describe what error message you're receiving. without watching no one can figure out what's going wrong.
14th Aug 2023, 3:45 PM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
0
Darpan kesharwani🇮🇳 I did that but like on browser when I try to change size make half or somthing like that it's pulls down image
14th Aug 2023, 3:47 PM
Ayato Sakamaki
Ayato Sakamaki - avatar
0
Darpan kesharwani🇮🇳 basic html and this code that I provided in css nothing more
14th Aug 2023, 3:59 PM
Ayato Sakamaki
Ayato Sakamaki - avatar
0
hi
15th Aug 2023, 4:51 AM
Sunday Aung
Sunday Aung - avatar
0
It’s not Ces it’s CSS
15th Aug 2023, 10:48 AM
Mohammad Nazim Mangal
Mohammad Nazim Mangal - avatar
0
Darpan kesharwani🇮🇳 idk what it is I will keep how it looks I think my browser has problem
15th Aug 2023, 10:50 AM
Ayato Sakamaki
Ayato Sakamaki - avatar
0
.... and make sure you name it `*.css` and include it into your html page (in the <head> tag with <link>) and the background image location is correct, the file exists.... the other option, use <style> tags inside the <head> tags. I think these are enough for now
15th Aug 2023, 2:04 PM
Mihaly Nyilas
Mihaly Nyilas - avatar
0
The code uses a relative link, consider using an absolute link to the full url of the image.
15th Aug 2023, 3:17 PM
Jonathan Shiell
0
Ayato Sakamaki , Try using margin:0 auto instead? Also, there is a @media tag for CSS. You can style your web in different device width or window. I hope this helps.
16th Aug 2023, 6:41 AM
Dragon RB
Dragon RB - avatar
0
Did it get sorted buddy
16th Aug 2023, 6:58 AM
Indiphile Menziwa
Indiphile Menziwa - avatar