Ich arbeite an einem Overlay für meine Galerie-Elemente, wenn ich überprüfe, ob das Targeting mit rotem Rand richtig ist, funktioniert es, aber wenn ich einen Schritt weiter gehen und ein hinzufügen möchte Hintergrundfarbe dazu tut es trotz Z-Index nicht. Was habe ich hier falsch gemacht? Clearfix macht keinen Unterschied. Overlay-Grenze funktioniert aber Hintergrundfarbe nicht
.gallery {
margin-top:50px;
}
.gallery-item {
padding:0px;
border:1px solid white;
z-index:101;
position:relative;
}
.gallery-item img {
position:relative;
width:100%;
z-index:101;
}
.gallery-overlay {
border:1px solid red;
background-color:rgba(255,255,255,.1);
position:relative;
width:100%;
z-index:102;
}
.gallery-caption {
height:50px;
display:none;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<div class="gallery clearfix col-sm-10 col-sm-offset-1">
<div class="row">
<div class="col-sm-4 gallery-item">
<div class="gallery-overlay">
<img class="img-responsive" src="http://lorempixel.com/500/500/" alt="500x500">
</div>
<p class="gallery-caption text-center">Item caption</p>
</div>
<div class="col-sm-4 gallery-item">
<div class="gallery-overlay">
<img class="img-responsive" src="http://lorempixel.com/500/500/" alt="500x500">
</div>
<p class="gallery-caption text-center">Item caption</p>
</div>
<div class="col-sm-4 gallery-item">
<div class="gallery-overlay">
<img class="img-responsive" src="http://lorempixel.com/500/500/" alt="500x500">
</div>
<p class="gallery-caption text-center">Item caption</p>
</div>
</div>
<!-- new row starts -->
<div class="row">
<div class="col-sm-4 gallery-item">
<div class="gallery-overlay">
<img class="img-responsive" src="http://lorempixel.com/500/500/" alt="500x500">
</div>
<p class="gallery-caption text-center">Item caption</p>
</div>
<div class="col-sm-4 gallery-item">
<div class="gallery-overlay">
<img class="img-responsive" src="http://lorempixel.com/500/500/" alt="500x500">
</div>
<p class="gallery-caption text-center">Item caption</p>
</div>
<div class="col-sm-4 gallery-item">
<div class="gallery-overlay">
<img class="img-responsive" src="http://lorempixel.com/500/500/" alt="500x500">
</div>
<p class="gallery-caption text-center">Item caption</p>
</div>
</div>
</div>
.gallery-item img {Position: relativ; Breite: 100%; z-index: -1;} Habe gerade versucht mit den anderen z-indexes gelöscht, aber immer noch nichts. – sklrboy
@sklrboy Schau dir meine Änderungen an dem obigen Post an. – haltersweb
Danke, so funktioniert es! :) – sklrboy