I need an SVG image to be fixed to a corner of a Div of varying size

Asked

Viewed 15 times

-1

wanted to know how to make an image (svg) get "stuck" to a corner of a div... ex: inserir a descrição da imagem aqui

I have DIV (purple) and SVG (red) where the DIV has a standard width and it n grows more than that, already at the time it can vary, and from there when it grows the SVG gets more or less like this where it was before: inserir a descrição da imagem aqui

And what I wanted was for the SVG to stay that way: inserir a descrição da imagem aqui

The SVG stuck in the lower left corner of the DIV... Sorry if I n explained right, I am new in this "area" of Css, html etc.

2 answers

0

I think position relative in the purple div and position Absolute in the red div, setting with top and left you set her position. Here’s the code:

div.pai {
position: relative;
}
svg {
position: absolute; //isso vai deixar o svg com posição absoluta relativa ao 
próximo elemento pai com position definida que não seja static
top: distância do topo aqui;
left: distância da esquerda aqui; //Valores negativos pra sair da box vermelha
;

0


  • 1

    It worked, I was wearing TOP instead of Bottom so when the DIV was bigger the SVG was still "stuck" on top of the DIV... Thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.