I have the following html
<div class="text">
<p>
<img ...> //properties are needed only for this
</p>
<img ...>
<figure>
<img ...>
</figure>
<p>
<img ...>
</p>
<p>
<figure>
<img ...>
</figure>
</p>
</div>
div.text img:first-of-type {
border: 5px solid red;
}
<div class="text">
<p>
<img src="https://dummyimage.com/150x150/aaa/fff">
</p>
<img src="https://dummyimage.com/150x150/aaa/fff">
<figure>
<img src="https://dummyimage.com/150x150/aaa/fff">
</figure>
<p>
<img src="https://dummyimage.com/150x150/aaa/fff">
</p>
<p>
<figure>
<img src="https://dummyimage.com/150x150/aaa/fff">
</figure>
</p>
</div>
First img may be children of div or wrapped in p, figure.
How can I add CSS-propreties for first img in ALL TREE of div.text?