French speaker sorry for bad syntax or misspelled words
Hi, my Uni asked an odd question in an assignment. They asked to add a SVG on the left of the footer using only CSS (the svg file is not in the html I have to had it in the css file). I tried using footer::before
in CSS but the svg is too big and if I try to scale it, it just go down outside the footer.
Here is the full code of what I tried:
footer{
height:50px;
margin-top:10px;
background-color:rgba(120,120,0,0.6);
}
footer::before {
content: url(https://img.uefa.com/imgml/uefacom/ucl/2021/logos/logo_dark.svg);
float: left;
scale: 0.1;
}
body {
background: black;
}
<footer>
<strong>Projet TW1 2023 : ma petite compo</strong><br> données issues de <a href="https://www.uefa.com/uefachampionsleague/" target="_blan ">uefa.com</a>
</footer>
Please note that I can’t erase or modify existing rule for footer{}
I can only add new rules.
I also tried to add directly the svg code with content: url("data:image/svg+xml;<svg>...</svg>")
but I could not get this to work
Thanks
2
Answers
Thanks to u/tridd3r on rediit for the answer.
His codepen Here
The solution was to add the svg as the background of
footer::before
and not a content :The closest I could get was with using
transform: scale(10%);
and settingdisplay: inline-block;
andtransform-origin: bottom left;
instead offloat:left;
andscale: 0.1;