您的位置:首頁技術文章
文章詳情頁

javascript - SVG字體在低版本chrome和移動端的縮放問題。

瀏覽:65日期:2022-12-27 14:14:18

問題描述

在360極速等低版本殼瀏覽器和移動端瀏覽器中,svg中<tspan>標簽中的字體無法正確縮放,在最新版本Chrome中正常。

<!DOCTYPE html><html lang='en'><head> <meta charset='UTF-8'> <style>tspan{ display: block;} </style></head><body><p> <svg viewBox='0,0,1000,1000' version='1.1' xmlns='http://www.w3.org/2000/svg'><text><tspan y='55.9' x='5.5'>After all the articles, ads, fliers, etc. have been prepared for the newsletter, the document should be assembled and may require </tspan></text> </svg></p></body></html>

當窗口縮小時,極速瀏覽器中字體大小縮放到12px就不會縮小了。最新chrome中正常。如果打開360極速的調試工具,把display:block屬性去掉就正??s放了。但直接在css中設置display:inline也不行。好奇怪。

問題解答

回答1:

只要給svg設置樣式 text-rendering='geometricPrecision' 就好了。

標簽: JavaScript
相關文章:
国产综合久久一区二区三区