Place text inside the image

Asked

Viewed 37 times

0

Here is my code

 .imgs{
   position:absolute;
   margin-top: -180px; 
   margin-left: 25px; 
   width: 200px; 
   height: 200px;
    }
<td style="width: 200px;"><?php echo '<img width=200px; src="'.$imagens[$aleatorio].'"'; ?></td>
  <figcaption style="width: 200px;" class="imgs"><?php  echo $list; ?></figcaption>
  
  
  

inserir a descrição da imagem aqui

1 answer

0


You can use the position: absolute; and change the location of the text with left , top, right and bottom

For too wide texts you can use the max-width and set the maximum size

span {
  position: absolute;
  left: 75px;
  top: 75px;
  color: white;
  max-width: 75px;
}
<div>
  <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSG2SKL5FJaXqyHfvxrxb5NmQ4ZcWgCPyaZvqEB0qsSubAyQHOBkw">
  <span>texto muito largo para caber em uma linha</span>
</div>

  • resolves, however I will have to do this for all screens, However when I write it exceeds the image, but the suggestion is valid

  • I edited the question with a simple solution for this

  • Okay, the fight paid off.

Browser other questions tagged

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