


How to Resolve Browser Discrepancies with -webkit-text-stroke CSS Property When Using Variable Fonts
Oct 24, 2024 am 02:47 AM<h2>Text Stroke (-webkit-text-stroke) CSS Problem</h2>
<p>Working on a personal project with NextJs and TailwindCSS, a developer encountered an issue with the text stroke using -webkit-text-stroke CSS property.</p>
<p>Upon using a private navigator to review progress, they observed that the text stroke was not functioning as intended in all browsers except Chrome. The desired stroke was visible, but it appeared differently across various browsers.</p>
<p>The code used was as follows:</p>
.outline-title { color: rgba(0, 0, 0, 0); -webkit-text-stroke: 2px black; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
<p>After investigating the issue, it was discovered that:</p>
<h2>-webkit-text-stroke Doesn't Work Well with Variable Fonts</h2>
<p>Variable fonts, which allow for customization of font properties such as weight and stretch, can interfere with the -webkit-text-stroke property.</p>
<h3>Quickfix/Update 2024: Apply paint-order to HTML Text</h3>
<p>As suggested by HyoukJoon Lee, applying the paint-order property to HTML text elements resolves the issue in all major rendering engines.</p>
.outline { -webkit-text-stroke: 0.04em black; paint-order: stroke fill; }
<p>This effectively renders the text stroke behind the fill color.</p>
The above is the detailed content of How to Resolve Browser Discrepancies with -webkit-text-stroke CSS Property When Using Variable Fonts. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Adding Box Shadows to WordPress Blocks and Elements

Create a JavaScript Contact Form With the Smart Forms Framework

Demystifying Screen Readers: Accessible Forms & Best Practices

Making Your First Custom Svelte Transition

Create an Inline Text Editor With the contentEditable Attribute

Comparing the 5 Best PHP Form Builders (And 3 Free Scripts)

File Upload With Multer in Node.js and Express
