Ich versuche, verschiedene Texte in der Bildmitte hinzuzufügen. Sieht so aus, als ob ich das nicht kann und brauche Hilfe bei der Aufgabe.Text auf dem Bild mit CSS und HTML nur
Also, ich habe 4 Bilder auf der Seite. Jetzt möchte ich Text auf die Bilder setzen. Was ich bisher habe, sind 4 Bilder auf der Seite, aber der Text wird nicht richtig angezeigt. Hier ist der Teil des HTML-
.images {
text-align: center;
padding: 15px 15px;
position: relative;
vertical-align: middle;
display: inline;
width: 430px;
margin: 10px 0;
}
#img-row {
display: block;
margin-top: -15px;
position: relative;
height: auto;
max-width: auto;
overflow-y: hidden;
overflow-x: auto;
word-wrap: normal;
white-space: nowrap;
text-align: center;
}
#img-row:after {
content: "";
position: absolute;
display: block;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.class {
position: relative;
}
.button {
display: block;
background-color: #bbb;
margin: 10px;
padding: 10px;
}
button.button {
width: 570px;
margin-left: 182px;
height: 40px;
font-size: 30px;
}
.caption-text {
display: block;
position: absolute;
width: 100%;
color: green;
left: 0;
bottom: 50%;
padding: 1em;
font-weight: 700;
z-index: 2;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
<div id="img-row">
<a href="">
<button class="button">
Button
</button>
</a>
</div>
<div id="img-row">
<a href="">
<img src="https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg" class="images" />
<figcaption class="caption-text">This is a caption text</figcaption>
</a>
<a href="">
<img src="https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg" class="images" />
<figcaption class="caption-text">This is a caption text</figcaption>
</a>
</div>
<div id="img-row">
<a href="">
<img src="https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg" class="images" />
<figcaption class="caption-text">This is a caption text</figcaption>
</a>
<a href="">
<img src="https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg" class="images" />
<figcaption class="caption-text">This is a caption text</figcaption>
</a>
</div>
Dies ist, wie es wie bisher aussieht: JSFIDDLE. Text erscheint nur zwei Mal.
Ihren Text geht über die gesamte Breite für beide Bilder in eine Reihe. Sie haben Ihren Text zweimal, aber es ist auf der gleichen Position, so dass Sie nur eine –