How TO - Tekstblokken over afbeelding
Leer hoe u tekstblokken over een afbeelding plaatst.
Afbeeldingstekstblokken
Hoe tekstblokken in afbeelding te plaatsen
Stap 1) HTML toevoegen:
Voorbeeld
<div class="container">
<img src="nature.jpg" alt="Norway"
style="width:100%;">
<div class="text-block">
<h4>Nature</h4>
<p>What a beautiful sunrise</p>
</div>
</div>
Stap 2) CSS toevoegen:
Voorbeeld
/* Container holding the image and the text */
.container {
position: relative;
}
/* Bottom right text */
.text-block {
position: absolute;
bottom: 20px;
right: 20px;
background-color: black;
color: white;
padding-left: 20px;
padding-right: 20px;
}
Lees onze tutorial over CSS-afbeeldingen voor meer informatie over het opmaken van afbeeldingen.
Lees onze tutorial over CSS-posities voor meer informatie over CSS- positionering .