Home > Software engineering >  change background with Css
change background with Css

Time:12-02

I want to change my background site so at first it changed but when I trying to change it again to another color it not happen I link my code file with style.css file with this code

{% load static %}

style.css (code):in my style.css folder

body{
background-color: blue;}

first I changed the background to brown then I want to change it to blue but it doesn't change

(also when I go to my site it still brown also when I use this code in style.css (body{ background-color: blue} when I click on inspect it appears to me body{ background-color: brown} )

CodePudding user response:

Try renaming the CSS file if ctrl f5 does not solve it.

CodePudding user response:

Maybe this is a technical problem with Django as that CSS code would normally work for me in VS Code.

Try writing that CSS code in the HTML file in a Style tag, although I'm not sure if that'll work for files committed into HTML.

CodePudding user response:

  1. You have to add templates in your setting.py as well as STATIC_URL = '/static/' then you have to restart your server with this command.

  2. You have to add CSS file in your static folder and that folder in your project then it will work.

See more at https://docs.djangoproject.com/en/3.2/howto/static-files

  • Related