The image which you want as background image has to be in static folder.
On Tue 25 Aug, 2020, 5:45 AM MAMADOU KANTE, wrote:
> I did load static at the top of the file {% load static %}.
> Also I linked the CSS file named style.css. Part of the css file was
> working perfectly. I only had issues
Hi,
Try this.
style="background: url(../images/showcase.jpg) no-repeat top center
!important;"
Add these in your settings.py file.
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
MEDIA
I did load static at the top of the file {% load static %}.
Also I linked the CSS file named style.css. Part of the css file was
working perfectly. I only had issues with the background image.
On Mon, Aug 24, 2020 at 4:02 PM sapna Choudhary wrote:
> create a directory named 'static' in the curre
create a directory named 'static' in the current directory. This directory
is used to store images/css files, you can load static in template using
{%load static%} this code block and link under image tag like this {%
static 'app_name/img.jpg' %}
On Mon, Aug 24, 2020 at 6:16 PM 'Akash Sinha' via
Hi
Create a folder inside ur project as static and keep ur images,css and js files
into that folder then in your settings.py file define static path. U need to
run python manage.py collect static command on terminal and then you have to
link that css file in HTML
Hint: check for Managing stati
Hi Everybody!
I am trying to set a background image using the STYLE tag with django
template as follows:
But when I open the HTML page and inspect the page I receive an image with
width zero. Can anyone help?
When I use the same syntax on a regular HTML without django templates it
works.
On Mon,
Hello your have to follow the direction where you stored your file .
Generally, in Django you create a static folder then maybe an image files
where you store the images. You should link the image this way src= "{%
static 'images/imag.png' %}"
On Mon, 3 Aug 2020, 10:06 Yemin Sajid, wrote:
> This
This may not work as intended if the CSS files are not rendered using the
Django template engine. You have to put the style declaration where you'd
need the image in the ** tag in your template code. From
there you can use the *{% static “images/imag.png” %}* syntax.
On Friday, July 31, 2020 at
tried this buddy yet it is not working
Regards
Chander Shekhar
(bestcsp)
On Thu, Jul 30, 2020 at 6:11 PM Irfan Khan wrote:
> {% static 'imag.jpg' %} instead of this try
>
> {% static “images/imag.png” %}
>
> On Thu, 30 Jul 2020 at 6:07 PM, Chander shekhar
> wrote:
>
>> I am unable to fetch
{% static 'imag.jpg' %} instead of this try
{% static “images/imag.png” %}
On Thu, 30 Jul 2020 at 6:07 PM, Chander shekhar wrote:
> I am unable to fetch images from css file .
> I have used {% load static %}
> {% static 'imag.jpg' %}
> buti can't fetch.console is saying image not found.
>
> -
10 matches
Mail list logo