Well as the title says I need to add an svg image to the background of a div. I have to add the image by css yes or yes.
css
.catalogo-gallery .btn-pdf
{
font-size: 17px;
font-weight: 800;
font-family: "Open Sans";
background-color: rgb(255, 255, 255);
border-style: solid;
border-width: 2px;
padding: 12px 50px;
text-decoration: none;
background-image: url("image.svg");
width:100%;
height: 100%;
}
html
<div class="div-btn" >
<a style="color:'.$color.'; border-color:'.$color.';" class="btn-pdf" href="'.$tipo_catalogo["pdf"]["url"].'">DESCARGAR</a>
</div>
I get this:
It will not be a problem of the relative path of the image? Maybe you should try putting the absolute path with respect to your domain.
For one thing: You can add a declaration to your wordpress theme's functions.php to allow you to upload svg to media:
In addition to that, you can put the images in an images folder inside your theme or your child-theme, which is where the css will look for them from (no need to add more path than the folder name).
In this case:
Another alternative is to use svg as the data uri:
Read more about SVG as data:uri