{"id":164823,"date":"2014-03-05T14:14:26","date_gmt":"2014-03-05T21:14:26","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=164823"},"modified":"2025-01-27T20:28:17","modified_gmt":"2025-01-28T03:28:17","slug":"text-rendering","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/t\/text-rendering\/","title":{"rendered":"text-rendering"},"content":{"rendered":"\n
The The You can see some before\/after examples here<\/a>. Sometimes the result is just straight up better kerning:<\/p>\n\n\n\n The Be aware that Windows, Linux and OS X each (may) have different text-rendering engines. Not to mention that different browsers each have their own text rendering defaults, so there is no guarantee that your font treatments will be displayed as intended on the user\u2019s system. You can learn more about type rendering systems and operating systems on the Typekit blog<\/a>.<\/p>\n\n\n\n There are four possible values:<\/p>\n\n\n\n The Ligatures are combinations of letters that tend to look better and are more readable as a combined glyph. An example of this is the letters \u2018f\u2019 and \u2018i\u2019. They can form the ligature \u2018fi\u2019 as in the word \u2018find\u2019. You can learn more about them here<\/a>.<\/p>\n\n\n\n Some font files contain additional information about how the font should be rendered. When it is said that there is a tradeoff between speed and precision, they aren’t kidding. There can be significant performance issues<\/a> to consider. That article is worth quoting entirely:<\/p>\n\n\n\n There are actually significant, effectively fatal performance problems (such as 30-second loading delays, or longer) on mobile devices when using optimizeLegibility for long pages. Apply it only if you know what the maximum text length will be. (Also, avoid using it for Android clients, at least on the older versions that everyone still uses: its font renderer often has very strange bugs when this mode is enabled.)<\/p>\n\n\n\n I did some testing with Instapaper to determine approximate optimizeLegibility performance limits. A 5,000-word article in Instapaper for iOS, for instance, will only use optimizeLegibility on devices with an A5-class or greater CPU. To avoid problems on older iOS devices, I wouldn\u2019t recommend using optimizeLegibility blindly and unconditionally on any pages longer than about 1,000 words. And I wouldn\u2019t recommend enabling it on Android at all.<\/p>\n<\/blockquote>\n\n\n\n It’s tempting to do:<\/p>\n\n\n\n But be darn careful about that, seems dangerous especially when applied to an arbitrary page.<\/p>\n\n\n There are various bugs. Android issue with new lines.<\/a> Chrome has various, including letter-spacing<\/a>. Safari (and others) default to optimizeSpeed<\/a> rather than determining on the fly.<\/p>\n","protected":false},"excerpt":{"rendered":" The text-rendering property in CSS allows you to choose quality of text over speed (or vice versa) allowing you to […]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":13949,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-almanac-single.php","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","_share_on_mastodon":"0","_share_on_mastodon_status":"%title% %permalink%"},"tags":[],"class_list":["post-164823","page","type-page","status-publish","hentry"],"acf":{"almanac_experimental":"No","related_content":"","show_toc":"No"},"share_on_mastodon":{"url":"","error":""},"jetpack-related-posts":[{"id":20517,"url":"https:\/\/css-tricks.com\/almanac\/properties\/u\/unicode-bidi\/","url_meta":{"origin":164823,"position":0},"title":"unicode-bidi","author":"Chris Coyier","date":"March 12, 2013","format":false,"excerpt":"The unicode-bidi property is one of two CSS properties that handle the rendering of bi-directional text in HTML and similar markup-based languages (eg XML). The other property is direction, and the two are used together to create levels of embedded text with different text directions (right-to-left and left-to-right) in a\u2026","rel":"","context":"With 2 comments","block_context":{"text":"With 2 comments","link":"https:\/\/css-tricks.com\/almanac\/properties\/u\/unicode-bidi\/#comments"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":253584,"url":"https:\/\/css-tricks.com\/almanac\/properties\/f\/font-display\/","url_meta":{"origin":164823,"position":1},"title":"font-display","author":"Geoff Graham","date":"April 17, 2017","format":false,"excerpt":"The font-display property defines how font files are loaded and displayed by the browser. It is applied to the @font-face rule which defines custom fonts in a stylesheet. @font-face { font-family: 'MyWebFont'; \/* Define the custom font name *\/ src: url('myfont.woff2') format('woff2'), url('myfont.woff') format('woff'); \/* Define where the font can\u2026","rel":"","context":"In \"font-display\"","block_context":{"text":"font-display","link":"https:\/\/css-tricks.com\/tag\/font-display\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":197696,"url":"https:\/\/css-tricks.com\/almanac\/properties\/i\/image-rendering\/","url_meta":{"origin":164823,"position":2},"title":"image-rendering","author":"Robin Rendle","date":"March 18, 2015","format":false,"excerpt":"The image-rendering property defines how the browser should render an image if it is scaled up or down from its original dimensions. By default, each browser will attempt to apply aliasing to this scaled image in order to prevent distortion, but this can sometimes be a problem if we want\u2026","rel":"","context":"With 11 comments","block_context":{"text":"With 11 comments","link":"https:\/\/css-tricks.com\/almanac\/properties\/i\/image-rendering\/#comments"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":342681,"url":"https:\/\/css-tricks.com\/almanac\/properties\/c\/content-visibility\/","url_meta":{"origin":164823,"position":3},"title":"content-visibility","author":"Idorenyin Udoh","date":"June 21, 2021","format":false,"excerpt":"The content-visibility property in CSS indicates to the browser whether or not an element\u2019s contents should be rendered at initial load time. So, as the browser starts loading content and is playing it on the screen, this property allows us to step in and tell the browser not to load\u2026","rel":"","context":"In \"content-visibility\"","block_context":{"text":"content-visibility","link":"https:\/\/css-tricks.com\/tag\/content-visibility\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/10\/visibility-nope.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/10\/visibility-nope.png?fit=1200%2C600&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/10\/visibility-nope.png?fit=1200%2C600&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/10\/visibility-nope.png?fit=1200%2C600&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/10\/visibility-nope.png?fit=1200%2C600&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":14081,"url":"https:\/\/css-tricks.com\/almanac\/properties\/o\/overflow\/","url_meta":{"origin":164823,"position":4},"title":"overflow","author":"Sara Cope","date":"September 5, 2011","format":false,"excerpt":"The overflow property controls what happens to content that breaks outside of its bounds: imagine a div in which you've explicitly set to be 200px wide, but contains an image that is 300px wide. That image will stick out of the div and be visible by default. Whereas if you\u2026","rel":"","context":"In \"overflow\"","block_context":{"text":"overflow","link":"https:\/\/css-tricks.com\/tag\/overflow\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/02\/overflow-float.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/02\/overflow-float.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/02\/overflow-float.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":161605,"url":"https:\/\/css-tricks.com\/almanac\/properties\/f\/filter\/","url_meta":{"origin":164823,"position":5},"title":"filter","author":"Chris Coyier","date":"February 18, 2014","format":false,"excerpt":"CSS Filters are a powerful tool that authors can use to achieve varying visual effects (sort of like Photoshop filters for the browser). The CSS filter property provides access to effects like blur or color shifting on an element\u2019s rendering before the element is displayed. Filters are commonly used to\u2026","rel":"","context":"In \"filter\"","block_context":{"text":"filter","link":"https:\/\/css-tricks.com\/tag\/filter\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/164823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=164823"}],"version-history":[{"count":7,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/164823\/revisions"}],"predecessor-version":[{"id":386208,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/164823\/revisions\/386208"}],"up":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/13949"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=164823"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=164823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}text-rendering<\/code> property in CSS allows you to choose quality of text over speed (or vice versa) allowing you to fine tune optimization by suggesting to the browser as to how it should render text on the screen. Said another way in MDN<\/a>:<\/p>\n\n\n\n\n
text-rendering<\/code> CSS property provides information to the rendering engine about what to optimize for when rendering text. The browser makes trade-offs among speed, legibility, and geometric precision.<\/p>\n<\/blockquote>\n\n\n\n
<\/figure>\n\n\n\ntext-rendering<\/code> property is not defined in any CSS standard<\/strong>. It’s actually an SVG property<\/a>. However, Gecko\/WebKit\/Blink browsers let you apply this property to HTML elements.<\/p>\n\n\n\n\n
geometricPrecision<\/code> can make text using those fonts look good. When SVG font is scaled, the browser calculates pixel size, then rounds to the nearest integer. The geometricPrecision<\/code> property allows for more fluid scaling. Note: Only WebKit browsers apply this fluid value, Gecko treats the value just like optimizeLegibility<\/code>.<\/li>\n<\/ul>\n\n\n< 20px enables ligatures<\/h3>\n\n\n
optimizeLegibility<\/code> keyword enables ligatures in text smaller than 20px for some fonts. (like Calibri or D\u00e9j\u00e0Vu) This 20px threshold value can be changed in Gecko via the browser.display.auto_quality_min_font_size<\/code> user preference.<\/p>\n\n\n\n
<\/figure>\n\n\n\noptimizeLegibility<\/code> makes use of this information, and optimizeSpeed<\/code> does not.<\/p>\n\n\nExample<\/h3>\n\n\n
p.legibility {\n text-rendering: optimizeLegibility;\n}\np.speed {\n text-rendering: optimizeSpeed;\n}<\/code><\/pre>\n\n\nPerformance<\/h3>\n\n\n
\n
\/* Probably not advisable *\/\nbody {\n text-rendering: optimizeLegibility;\n}<\/code><\/pre>\n\n\n\nBrowser Support<\/h3>\n\n\n\n