javascript - SVG字體在低版本chrome和移動端的縮放問題。
問題描述
在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屬性去掉就正常縮放了。但直接在css中設置display:inline也不行。好奇怪。
問題解答
回答1:只要給svg設置樣式 text-rendering='geometricPrecision' 就好了。
相關文章:
1. docker - 各位電腦上有多少個容器啊?容器一多,自己都搞混了,咋辦呢?2. java - spring boot 如何打包成asp.net core 那種獨立應用?3. java - 在用戶不登錄的情況下,用戶如何添加保存到購物車?4. datetime - Python如何獲取當前時間5. javascript - nginx反向代理靜態資源403錯誤?6. docker網絡端口映射,沒有方便點的操作方法么?7. 安全性測試 - nodejs中如何防mySQL注入8. javascript - 關于apply()與call()的問題9. docker start -a dockername 老是卡住,什么情況?10. python - 調用api輸出頁面,會有標簽出現,請問如何清掉?
