Reputation: 319
I am new to Django and I am using a CSS file for my styles and for now the styles are applied to my html. Now I have created a new class:
.post-image {
height: 500px;
width: 500px;
}
and have applied the class to the HTML element I want to style like this:
<img class="post-image" src="{{ post.image.url }}" alt="">
But the class post-image
does not apply somehow. When I change it back to the old class the image gets resized. Also when I tried to edit the old class in my main.css
the changes were not applied.
My main.css
file is in my static directory and I have added the static directory in my settings.py
file like this:
STATIC_URL = '/static/'
and I have imported the stylesheet in my base.html
like this:
<link rel="stylesheet" type="text/css" href="{% static 'feed/main.css' %}">
Upvotes: 1
Views: 1761
Reputation: 1
You must have the following code in the setting.py
STATIC_URL = '/static/'
STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ]
Upvotes: -1