1
Hello, I have a website that has posts... and in some posts I put pictures on them, but these images are not responsive! and there’s no way to change her class to a responsive class... because these posts are taken from a database for $variables I’ve tried through css this:
.welcome-content > img {
max-width: 100%;
height: auto;
}
but unsuccessfully... can anyone tell me any way whenever I have an "img" inside the div "Welcome-content" to get responsive? like, leave a responsive image I know!! but I want all the images that are in the "Welcome-content" div that in this case will not have a responsive class.
My div is 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/<?php echo $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;
}
How is the HTML of these images? Post the question that makes it easier to analyze the problem.
– Sam
By the way, have you tried using
!important
? Type:max-width: 100% !important;
– Sam
Yes, yes........
– Gustavo Gbn
That class
foto
does what?– Sam
The selector is wrong. The right one would be
.welcome-content p img{
– Sam
She doesn’t do anything. She wasn’t even supposed to be there.
– Gustavo Gbn
The image is inside a
p
– Sam
Wow.. I would never have noticed! Thank you!!
– Gustavo Gbn