2
Using the pseudoelement :after
, I created an image caption. How can I make the caption on top of the image and not on the bottom?
.estrutura{
width:10%;
height:30%;
}
.estrutura:after{
position: fixed;
content:"Estrutura";
width:20%;
height:20px;
background-color: blue;
}
<div class="estrutura">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Biandintz_eta_zaldiak_-_modified2.jpg/550px-Biandintz_eta_zaldiak_-_modified2.jpg">
</div>
The top you mean, would be before or about? if it’s before you can use the
:before
thus the content is placed before the image– Brumazzi DB
On top of the image. At the bottom of it. At the bottom.
– Zkk
tried to use the
z-index
?– Brumazzi DB
Run the Snippet and open in full screen to see the created element
– Zkk