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

Background Image

Hi, I´m trying to set a background image inside mi css body, but I can´t and I don´t know why. Mi folders order is: web project css syle.scss style.css img backgroundImage.jpg index.html This is mi .scss: *, *::after, *::before { box-sizing: border-box; padding: 0; margin: 0; } body { background-image: url(../img/backgroundImage.jpg); .main-container { height: 100vh; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: 15% 70% 15%; grid-template-areas: "cabecera cabecera cabecera cabecera" "principal principal principal sidebar" "pie pie pie pie"; .main-header { padding-top: 1rem; display: flex; flex-wrap: nowrap; justify-content: space-between; grid-area: cabecera; border: 2px solid black; .logo{ margin-left: 2rem; margin-top: 1.4rem; text-transform: uppercase; } .main-nav{ ul{ margin-right: 2rem; margin-top: 2rem; display: flex; li { list-style: none; margin: 0 0.5rem; a{ text-decoration: none; color: black; cursor: pointer; } a:hover{ color: white; font-weight: bold; } } } } } .main-section {

13th May 2020, 2:50 PM
Miguel José Rodríguez Martínez
Miguel José Rodríguez Martínez - avatar
17 Answers
+ 2
I am dam sure that image is not set in your background by writing background-image in css. Instead you have to write following: background:url("path of image.jpg") center no-repeat;
15th May 2020, 12:37 PM
NEEL SHAH
NEEL SHAH - avatar
+ 1
Miguel Rodriguez Martinez I see, Sololearn issue again....
13th May 2020, 4:55 PM
Calviղ
Calviղ - avatar
+ 1
I'm not sure whether this would work or not: background-image: url('../img/background Image.jpg'); if that doesn't work in case you can take an image from a website.
13th May 2020, 6:08 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
NEEL SHAH I tried that before and ir doesn't work too.
16th May 2020, 8:54 AM
Miguel José Rodríguez Martínez
Miguel José Rodríguez Martínez - avatar
0
background:transparent; grid-area: principal; border: 2px solid black; } .sidebar-right{ background:transparent; grid-area: sidebar; border: 2px solid black; } .main-footer { background:transparent; grid-area: pie; border: 2px solid black; } } }
13th May 2020, 2:51 PM
Miguel José Rodríguez Martínez
Miguel José Rodríguez Martínez - avatar
0
Miguel Rodriguez Martinez you can share the code from Code Playground?
13th May 2020, 3:48 PM
Calviղ
Calviղ - avatar
0
Calviղ I tried to save the code but the save never ends
13th May 2020, 4:41 PM
Miguel José Rodríguez Martínez
Miguel José Rodríguez Martínez - avatar
0
Any idea of what is wrong?
13th May 2020, 5:26 PM
Miguel José Rodríguez Martínez
Miguel José Rodríguez Martínez - avatar
0
Set width and height
14th May 2020, 4:56 PM
Md. Aktaruzzaman Talukdar
Md. Aktaruzzaman Talukdar - avatar
0
Coding Kitty I tried it but it doesn't work
14th May 2020, 6:04 PM
Miguel José Rodríguez Martínez
Miguel José Rodríguez Martínez - avatar
0
Md. Aktaruzzaman Talukdar to de body? Or the background-image?
14th May 2020, 6:04 PM
Miguel José Rodríguez Martínez
Miguel José Rodríguez Martínez - avatar
0
Background image
14th May 2020, 6:42 PM
Md. Aktaruzzaman Talukdar
Md. Aktaruzzaman Talukdar - avatar
0
Try again
16th May 2020, 8:56 AM
NEEL SHAH
NEEL SHAH - avatar
0
NEEL SHAH You were absolutly right men. It's work perfectly, thanks!!!
16th May 2020, 9:26 AM
Miguel José Rodríguez Martínez
Miguel José Rodríguez Martínez - avatar
0
Thanks
16th May 2020, 2:44 PM
NEEL SHAH
NEEL SHAH - avatar
0
Ok
16th May 2020, 2:44 PM
NEEL SHAH
NEEL SHAH - avatar
0
How to put an image as a background tutorial: https://code.sololearn.com/WA87A25A25A1/#
24th Feb 2021, 8:47 AM
MNMNMN