Hello, I'm having a problem. I'm trying to make each post have a different background color. I tried to use this code below in css but it leaves all the posts of a single color.
div.postagem > div:nth-child(1) {
background: #edc333;
}
div.postagem > div:nth-child(2) {
background: #000;
}
div.postagem > div:nth-child(3){
background: #3e4095;
}
Here is the code I have in my posting area:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="col-md-4"><div class="postagem">
<div class="postagem-imagem">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail( 'miniatura' );
} ?></div>
<div class="titulo"> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a></div>
</div></div>
<?php endwhile?>
<?php else: ?>
<h2>Nada Encontrado</h2><?php endif; ?>
This is the code I have in css.
.postagem {
height: 340px;
overflow: hidden;
}
.postagem img {
opacity: 0.2;
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
}
.postagem-imagem img {
opacity: 0.3;
}
.titulo {
font-size: 17.473px;
font-family: "Arial";
color: rgb(254, 255, 254);
font-weight: 900;
padding: 20px;
text-transform: uppercase;
line-height: 1.2;
text-align: left;
position: absolute;
z-index: 111;
top: 45px;
}
.titulo a {
color: #fff;
}
Could anyone help? Thank you in advance!