I'm currently using Django as explained in cs50w 2020 lecture 3. Under the static folder inside encyclopedia directory is the styles.css. This was in the distro code and there is already some styles coded in it. But when I want to add my own styles, it does not show up in the webpage. Even on elements in the existing pages given in the distro code.All the existing styles defined by the staff is useable, but for some reason no new styles can be added. Where am I going wrong?

#err_div {
    background-color: gray;
    justify-content: center;
    padding: 20px;

These were a few lines I added for an error page I wanted to create.

        <div id="err_div">
            <h2>The Entry ({{name}}) you are looking for was not found!</h2>
            <a href="{% url 'index'%}">Back to Home Page</a>

This was the div inside my error page I wanted to style

<link href="{% static 'encyclopedia/styles.css' %}" rel="stylesheet">

This is the link part of the same error page, I know it's linked properly with css file as I can use any other style classes implemented by the staff.

  • Use dev tools in the browser to see if the modified CSS has been loaded. Could be a vicitim of caching; ctrl-f5 (or shift-refresh arrow, or ctrl-r )will do a complete reload. Jul 25, 2020 at 21:08
  • DinoCoderSaurus - That worked, thanks. Opening it in incongito or doing a complete reload fixed it. Jul 26, 2020 at 6:08


You must log in to answer this question.

Browse other questions tagged .