Is there any way to make responsive text inside an image? I would like to do it without using media queries. I already tried this Horizontal centering text over image via CSS but it does not work.
The problem (pic. down) is when reaching small screen values, the text goes outside the image and it does not resize it. With media queries I could do it just by changing the size of the text, but is not any other way to do it?
HTML code:
<div class="wrapper-pig">
<center><img src="http://s24.postimg.org/4axzhhujp/schwein.png" style="width: 70%; height=auto;"/></center>
<div class="pig-text" >
<span style="color:white;" >9563</span>
</div>
</div>
CSS code:
.wrapper-pig{
width: 100%;
background-color: yellow;
position: relative;
box-sizing: border-box;
}
.pig-text{
font-size: 160%;
position: absolute;
display: inline-block;
left: 40%;
top: 40%;
}
Please, any help?
I prepared a fiddle to show the problem better: My fiddle