In this question - If the staff and community won't mind - I would like to address two different bugs of different browsers, though ocuring on same conditions.
The bugs happen when an element with display:inline
(and a box-shadow
, but this is set here more for a demonstration purpose) gets opacity
less than 1. Then
- IE 10 (at least) chops the box-shadow as if "overflow:hidden" was set.
- Opera 12.15 leaves the box shadow only on the first line of the text.
The HTML to demonstrate the issue:
<span class="inline opaque">
<span>Some text.</span>
</span>
CSS:
.inline{
display:inline;
background:red;
box-shadow:0 0 0 10px red;
}
.inline.opaque{
opacity:.5;
}
A live example. I am really frustrated with this happening. Seems very strange and unnatural for me. Would be very grateful for any help.
Thanks!
UPDATE. Seems I have found some workaround for IE. It turns out, that we can shift the box-shadow
to the left and top (the directions it doesn't crop in this bug). And to make the element visually occupy the same space, a transform
can be applied. It's better visible here
@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){
.block{
-ms-transform:translate(5px, 5px);
transform:translate(5px, 5px);
}
.inline{
box-shadow:-5px -5px 0 5px #c0c;
}
}
Note, that we need to shift (possibly with translate
) the contents of .inline
as well.
opacity:.5
rule.opaque
. – Tigerish