css3 - Issue with custom icon font rendering differently in different browsers -


having issues custom icon font. renders differently between safari , chrome. appears between 1-2 pixels lower in safari. can somehow have render same in both browsers?

created icon font exporting 16 x 16 px svg sketch , imported them icomoon , put optimize metrics 16 automatic.

grid on icomoon

chrome os x

safari os x

live example: http://jsfiddle.net/qq7mv/

html:

<a href="" class="button increase">&#x2b;</a> 

css:

* {     box-sizing: border-box;     -webkit-box-sizing: border-box;     -moz-box-sizing: border-box;     -o-box-sizing: border-box;     -ms-box-sizing: border-box; } @font-face {     font-family: "icons";     src: url("http://cl.ly/qo0t/icons.ttf") format("truetype");     font-weight: normal;     font-style: normal; } {     display: block;     text-decoration: none;     outline: none; } .button {     width: 115px;     height: 37px;     color: #333333;     font-size: 14px;     font-weight: bold;     text-align: center;     line-height: 35px;     margin: 0 auto 20px auto;     background-color: #edeef0;     background-repeat: no-repeat;     border-radius: 4px;     -webkit-border-radius: 4px;     -moz-border-radius: 4px;     -o-border-radius: 4px;     -ms-border-radius: 4px;     transition-property: background-color, opacity;     -webkit-transition-property: background-color, opacity;     -moz-transition-property: background-color, opacity;     -o-transition-property: background-color, opacity;     -ms-transition-property: background-color, opacity;     transition-duration: 0.2s;     -webkit-transition-duration: 0.2s;     -moz-transition-duration: 0.2s;     -o-transition-duration: 0.2s;     -ms-transition-duration: 0.2s;     user-select: none;     -webkit-user-select: none;     -moz-user-select: none;     -o-user-select: none;     -ms-user-select: none;     -webkit-user-drag: none; } .button.increase, .button.decrease {     display: inline-block;     vertical-align: top;     width: 23px;     height: 23px;     font-family: "icons";     font-size: 8px;     font-weight: normal;     line-height: 1;     padding: 8px 0 0 0;     -webkit-font-smoothing: antialiased; } .button.increase {     margin: 13px 5px 0 11px; } .button.decrease {     margin: 13px 0 0 0; } 

so found problem myself. there might better solution 1 solved me. feel free still reply solution.

http://icomoon.io/#docs/font-face

a crisp size listed each of icon sets in icomoon's library tab. best results, should use size when using font. example, if icon set optimized (16 × n)px sizes, crisp results setting font-size 16px, 32px, 48px (= 3 × 16px), etc.

basically want avoid importing different size svg you'll using in css. example if import 16x16px svg icons icomoon , use 8px font-size on them, they'll render poorly. instead import 8x8px svg icons , they'll render same in both chrome , safari.

when i'm saying rendering i'm refering vertical alignment of icon fonts.

live example: http://jsfiddle.net/qq7mv/3/

html:

<a href="" class="button increase">&#x2b;</a> 

css:

* {     box-sizing: border-box;     -webkit-box-sizing: border-box;     -moz-box-sizing: border-box;     -o-box-sizing: border-box;     -ms-box-sizing: border-box; } @font-face {     font-family: "icons";     src: url("http://cl.ly/qnnx/icons.ttf") format("truetype");     font-weight: normal;     font-style: normal; } {     display: block;     text-decoration: none;     outline: none; } .button {     width: 115px;     height: 37px;     color: #333333;     font-size: 14px;     font-weight: bold;     text-align: center;     line-height: 35px;     margin: 0 auto 20px auto;     background-color: #edeef0;     background-repeat: no-repeat;     border-radius: 4px;     -webkit-border-radius: 4px;     -moz-border-radius: 4px;     -o-border-radius: 4px;     -ms-border-radius: 4px;     transition-property: background-color, opacity;     -webkit-transition-property: background-color, opacity;     -moz-transition-property: background-color, opacity;     -o-transition-property: background-color, opacity;     -ms-transition-property: background-color, opacity;     transition-duration: 0.2s;     -webkit-transition-duration: 0.2s;     -moz-transition-duration: 0.2s;     -o-transition-duration: 0.2s;     -ms-transition-duration: 0.2s;     user-select: none;     -webkit-user-select: none;     -moz-user-select: none;     -o-user-select: none;     -ms-user-select: none;     -webkit-user-drag: none; } .button.increase, .button.decrease {     display: inline-block;     vertical-align: top;     width: 23px;     height: 23px;     font-family: "icons";     font-size: 8px;     font-weight: normal;     line-height: 1;     padding: 7px 0 0 0;     -webkit-font-smoothing: antialiased; } .button.increase {     margin: 13px 5px 0 11px; } .button.decrease {     margin: 13px 0 0 0; } 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -