I am testing custom icon fonts in a web app using Safari / iOS 5.1. The icons show up in the viewport on page load, but when I scroll down past the viewport they are missing. If I inspect an element and make any minor change, the missing font's will appear, but again, only those fonts in the current viewport.
Here's an example of the CSS:
.icon-test:before {
content: "\e025";
}
Everything works fine in Safari 6.1, the problem is only occurring in iOS 5.1. Has anyone experienced this problem?
EDIT: As I was debugging, I disabled position:relative in the code inspector and the icons started appearing correctly.
Here's the test CSS:
@font-face {
font-family: 'custom';
src: url('fonts/custom.woff') format('woff'),
url('fonts/custom.ttf') format('truetype');
}
.icon-test-1, .icon-test-2 {
font-family: 'custom';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
/*font-size: 28px;*/
color: #666666;
}
.icon-test-1:before {content: "\e000";}
.icon-test-2:before {content: "\e00e";}
.btn {
position: relative;
top:4px;
float:right;
clear: both;
display: block;
height: 50px;
}
Here's the test HTML:
<div style="height:200px;width:500px;overflow: auto;">
<a class="btn" href="#"><i class="icon-test-1"></i></a>
<a class="btn" href="#"><i class="icon-test-2"></i></a>
<a class="btn" href="#"><i class="icon-test-1"></i></a>
<a class="btn" href="#"><i class="icon-test-2"></i></a>
<a class="btn" href="#"><i class="icon-test-1"></i></a>
<a class="btn" href="#"><i class="icon-test-2"></i></a>
<a class="btn" href="#"><i class="icon-test-1"></i></a>
<a class="btn" href="#"><i class="icon-test-2"></i></a>
<a class="btn" href="#"><i class="icon-test-1"></i></a>
<a class="btn" href="#"><i class="icon-test-2"></i></a>
<a class="btn" href="#"><i class="icon-test-1"></i></a>
<a class="btn" href="#"><i class="icon-test-2"></i></a>
<a class="btn" href="#"><i class="icon-test-1"></i></a>
<a class="btn" href="#"><i class="icon-test-2"></i></a>
<a class="btn" href="#"><i class="icon-test-1"></i></a>
<a class="btn" href="#"><i class="icon-test-2"></i></a>
</div>