Home > Mobile >  CSS SVG BackGround image in Django
CSS SVG BackGround image in Django

Time:09-18

i used en template who use bootstrap 5,

in the css i can find : background-image: url("data:image/svg xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'/><path fill='none' stroke='#343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/></svg>");

it seems django don't find this url

The bootstrap 5.0 css for select form didn't work and show a standard select box not a bootstrap 5 look .

thx for help

CodePudding user response:

Often the problem with svg's are that some applications/ browsers ignore them because of a missing line.

Add the svg code in to a separate file and save as svg. On the top of the file add: <?xml version="1.0" encoding="UTF-8"?> this insures the svg is readable.

Now the only thing you have to do is add the background-image as an image itself like: background-image: url("/images/name.svg");

  • Related