Image Background project djgango

0

I'm playing with a quite old project (django 1.5.12) and I do not know how to set a background image for the main screen, I do not have much knowledge in css, in advance thank you very much.

I have attached the code of my html:

in place an image to try and load it but disproportionate and off center.

I have the css in static / css and the image in static / img

so modify the html:

and this is the app.css

    
asked by J Irenicus 09.07.2018 в 19:27
source

2 answers

0

Add a style sheet, example app.css, delete what you have in the background image html, and add this line

<link rel="stylesheet" href="URL DE LA HOJA DE ESTILOS.css">

Then in the style sheet add this:

 body{
  background-image: url("URL DE LA IMAGEN");
  height: 100vh;
 }

And tell me how it went.

    
answered by 10.07.2018 в 04:22
0

so that the image is seen correctly in all resolutions you should replace your code:

body{
  background-image: url("static/img/joblist.jpg");
  height: 100vh;
}

for this:

body { 
  background: url("static/img/joblist.jpg") no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

This is what covers the entire body of the page depending on how large the browser window is and also compatible with all browsers.

Also as Christian said, make sure that the "link" is inside the "head" header and that the "static / img / joblist.jpg" path is correct.

For the first, you would have to locate the master page or template, since "portada.html" is a simple "div" so there it will never work for you no matter how much you put the "link" to your CSS, you must have a file that contains the template of the page (master page) or header, I recommend you look for the tag "head" between the files of your project with the search engine of your editor.

Anything you tell us.

    
answered by 11.07.2018 в 18:16