Czy jest możliwa dynamiczna zmiana koloru tekstu na podstawie koloru tła za pomocą CSS lub JS, jeśli nie jest to możliwe przy CSS? Mam obraz, który znajduje się pod tekstem. Kolor mojego tekstu jest biały, ale obraz ma biały kształt. A gdy tekst przekracza biały kształt, muszę zmienić kolor tekstu w ciemniejszym kolorze.Zmiana koloru tekstu na podstawie koloru tła
HTML:
<div class="biography">
<img src="http://s16.postimg.org/c09zw94jp/author_photo.png" alt="author" class="bio-img">
<div class="biography-text">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit <br>
Vestibulum pellentesque auctor quam a sollicitudin.<br>
Pellentesque accumsan a sem eget dictum.
</p>
<p>
Morbi dictum lorem tortor, id consequat libero gravida ut.<br>
Nullam dictum sed massa et bibendum.
</p>
<p>Praesent sed dui mattis, dictum urna sit amet, imperdiet purus.</p>
<p> Suspendisse potenti.</p>
</div>
</div>
CSS:
body {
background-color: #7ccbe6;
}
.biography {
min-height: 410px;
}
.biography .biography-text {
position: relative;
margin-top: -420px;
padding: 82px 130px 0 380px;
z-index: 1;
}
.biography-text {
color: #fff;
}
Oto Codepen zobaczyć lepszy obraz.
Podobne -http: //stackoverflow.com/questions/35443187/how-do-i-determine-background-color-of-visible-underlying-element/35444374#35444374 –