html – Hide the text of a div using CSS

Question:

Suppose I have the following div:

<div class="contenido">

<img src="pepito.jpg">

Hombre

</div>

I need to hide the text "Man".

How do i do it? With clear css this

Answer:

Using .css you can hide only the text by setting the text size to 0:

.contenido{
   font-size: 0;
}
  <div class="contenido">

    <img src="pepito.jpg">

    Hombre

    </div>

or defining a transparent color:

 .contenido{ color: transparent; }
 <div class="contenido"> <img src="pepito.jpg"> Hombre </div>

NOTE: Using this option the text will be visible if it is selected.

Scroll to Top