9
Is there any way to transpose a text div
, like coming in from one side and coming out from the other?
My idea would be something like these images. Where the text starts on one side and goes through inside of div
. Is there any way to do this with CSS, and that I can change the text without having to mess with the CSS code to adapt every time I change the text?
OBS: It doesn’t have to look exactly like the pictures, it’s just to illustrate the idea.
Code model:
* {
box-sizing: border-box;
}
.texto {
/* border: 1px solid blue; */
text-align: center;
padding: 10px 0 10px 0;
position: relative;
overflow: hidden;
margin: 0 auto;
width: 50%;
perspective: 120px;
}
.texto span {
display: inline-block;
font-size: 50px;
font-family: sans-serif;
border: 6px solid red;
}
<div class="texto">
<span>meu texto</span>
</div>
You can put the element
::before
withz-index: -1
and the element::after
withz-index: 1
. Leaving the "middle" element withz-index: 0
. Or forget CSS and go pro SVG, which is much simpler to manipulate.– Renan Gomes
I don’t even know if I should comment on this because it’s off-topic, but your questions are excellent!
– fernandosavio
@fernandosavio was worth young, most of them are to enrich the community trying to bring more content to "data base", is a way to keep things moving, keep the engagement of employees etc. Thanks for the kindness =)
– hugocsl
You can do it with SVG.
– Diego Souza
@Renan believe that this is a way yes! after all one is ::before, and the other is ::after, I think we could do working the z-index yes
– hugocsl
@Diegosouza yes SVG helps a lot in these hours, the clip-path tb would solve, but does not work in IE :/
– hugocsl