Is it possible to prevent text-shadow
from overlapping text within the same element (e.g. a h1
)? Please see an exaggerated example image below – in my use case I would like the text to be very bright white, but instead the shadow is overlapping it and causing murky grey areas.
I made a reduced test case here to demonstrate: http://codepen.io/approach/pen/LgaIe
Note : I deliberately used a small line-height
to highlight this issue
By using a comma, we can specify multiple text shadows. Here we have created the first text shadow with the same color as th background to give a semi-3D effect.
Simply reloading the page solves it. Screen resolution and text size affect this. Try sizing up or down with CTRL + or -. This resets the page zoom.
The text-shadow CSS property adds shadows to text. It accepts a comma-separated list of shadows to be applied to the text and any of its decorations . Each shadow is described by some combination of X and Y offsets from the element, blur radius, and color.
You could consider putting another layer of text above the shadowed text:
Basic Working Example
<div class="cover">
<h1><a href="#">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Impedit eveniet eos deleniti provident ab nam laborum at voluptatem est iste ratione quis error perspiciatis debitis.</a></h1>
</div>
.cover{
position:absolute;
top:0;
}
.cover h1 a{
color: white;
}
Or to save a little time and typing:
jQuery Working Example
$(function () {
$('.wrapper').children().clone().css({
position: 'absolute'
}).prependTo('body');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With