How to Fix Inconsistent Text Stroke Appearance in Different Browsers?

Susan Sarandon
Release: 2024-10-24 06:02:02
Original
417 people have browsed it

How to Fix Inconsistent Text Stroke Appearance in Different Browsers?

Text Stroke (-webkit-text-stroke) CSS Problem

When using the -webkit-text-stroke CSS property, some users may encounter issues with the stroke's appearance on browsers other than Chrome. This problem, particularly prevalent in browsers that do not fully support variable fonts, can result in the stroke appearing inconsistent with the desired behavior.

Quick Fix/Update 2024: Paint-order for HTML Text

As suggested by HyoukJoon Lee, applying the SVG paint-order property to HTML text elements can effectively resolve this issue. Counterintuitively, the paint-order property, which determines the order in which elements are painted, can be applied to HTML text, as evidenced by support in all major rendering engines.

By leveraging paint-order, the stroke can be rendered behind the text-fill color, similar to the desired behavior in Chrome. Implementing this fix requires altering the CSS as follows:

.outline {<br>  -webkit-text-stroke: 0.04em black;<br>  paint-order: stroke fill;<br>}

The above is the detailed content of How to Fix Inconsistent Text Stroke Appearance in Different Browsers?. For more information, please follow other related articles on the PHP Chinese website!

source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template