box-shadow inset für img-Elemente

Zwei Möglichkeiten, mit Css Schlagschatten auf Bildern zu erzeugen

Schatten (de-)aktivieren

:before und Css-Verlauf

Html

<figure class="picture gradient">
	<img src="img/content/beispielbild.jpg" />
</figure>

Css

.picture {
	position: relative;
}

.picture:before {
	content: "";
	position: absolute;
	z-index: 1;
	top: 0;
	left: 0;
	width: 100%;
	pointer-events: none;
}

.picture.gradient:before {
	height: 10px;
	height: .625rem;
	background-image: -webkit-linear-gradient(top, rgba(88, 88, 88, .15) 0%, rgba(0, 0, 0, 0) 100%);
	background-image: -moz-linear-gradient(top, rgba(88, 88, 88, .15) 0%, rgba(0, 0, 0, 0) 100%);
	background-image: linear-gradient(top, rgba(88, 88, 88, .15) 0%, rgba(0, 0, 0, 0) 100%);
}
Schatten (de-)aktivieren

:before und box-shadow

Html

<figure class="picture box-shadow">
	<img src="img/content/beispielbild.jpg" />
</figure>

Css

.picture {
	position: relative;
}

.picture:before {
	content: "";
	position: absolute;
	z-index: 1;
	top: 0;
	left: 0;
	width: 100%;
	pointer-events: none;
}

.picture.box-shadow:before {
	height: 100%;
	box-shadow: inset 5px 5px 5px rgba(88, 88, 88, .15);
}