I need to set text to have background from parent div, the problem I got is that I cannot set that background, because I have the text inside another div. Here is example.
.p1{
background-color: pink;
width: 500px;
height: 500px;
display: flex;
justify-content: center;
align-items: center;
}
.p2{
width: 250px;
height: 250px;
text-align: center;
background-color: green;
}
.title{
color: transparent;
}
<div class="p1">
<div class="p2">
<h1 class="title">Test</h1>
</div>
</div>
I need the H1 to be pink as the first div. In my project I don't use pink color, but background-image.