Consider the following example that renders a semi-transparent red layer onto some text.
<div style="position: relative">
<p>
Foo
</p>
<p>
Bar
</p>
<div style="position: absolute; left: 0; top: 0; bottom: 0; right: 0; background: rgba(255,0,0,0.5)">
</div>
</div>
There are some issues on iOS Safari that makes using relative-divs in scrolling areas flaky.
So, is there a way to achieve the same effect of overlaying without using relative divs? CSS only, no JavaScript!
EDIT:
The actual effect I want to achieve is to change the overlay into a different color when the mouse hovers.
EDIT:
Looks like the "flakiness" is still present in current iOS versions. Here are some OLDER references to similar problems:
- Elements disappear when scrolling in Safari - -webkit-transform fix only works the first time
- https://github.com/scottjehl/Device-Bugs/issues/8
- webkit-overflow-scrolling makes element disappear
- iPad Safari scrolling causes HTML elements to disappear and reappear with a delay
- iPad Safari elements disappear and reappear with a delay