Resize img within a div

1

Hello, I have a site that has posts ... and in some posts I put images in them, however these images are not responsive! and there is no way to change her class to a responsive class ... because these posts are taken from a database for $ variables I've already tried through css this:

.welcome-content > img {
  max-width: 100%;
  height: auto;    
   }

but unsuccessfully ... can someone tell me somehow whenever I have an "img" within the "welcome-content" div to be responsive? kind, leave a responsive picture I know !! but I want all the images that are in the "welcome-content" div that in this case, do not have a class to be responsive.

My div looks like this:

<div class="welcome-content" align="left">
        <?php if($descricao != null){?><p class="descricao"><?php echo $descricao;?></p><? }?>

        <?php if($imagem != null){?><p><img src="<?php echo $imagem;?>" class="foto"/></p><? }?>

        <p><span class="glyphicon glyphicon-time" aria-hidden="true"></span> Postado em: <?php echo $data." às ".$hora;?> <br>
<?php if($postador != null){?>Postado por: <?php echo "$postador";?> <img src="https://minotar.net/avatar/<?phpecho$postador?>/20"></p><? }else{
    echo "<p>Postado por: não informado</p>";
} ?>

    </div>

and my css:

.welcome-content { 
    background-color: #fff;    
    padding: 5px 20px; 
    padding-bottom: 10px; 
}

.welcome-content > img {
    max-width: 100%;
    height: auto; 
}
    
asked by anonymous 19.05.2018 / 01:34

1 answer

0

You are using the wrong selector:

.welcome-content > img

See that the image is still inside a paragraph <p> , so it would have to be:

.welcome-content p img
    
19.05.2018 / 01:46