javascript - SVG字體在低版本chrome和移動(dòng)端的縮放問題。
問題描述
在360極速等低版本殼瀏覽器和移動(dòng)端瀏覽器中,svg中<tspan>標(biāo)簽中的字體無法正確縮放,在最新版本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>
當(dāng)窗口縮小時(shí),極速瀏覽器中字體大小縮放到12px就不會(huì)縮小了。最新chrome中正常。如果打開360極速的調(diào)試工具,把display:block屬性去掉就正常縮放了。但直接在css中設(shè)置display:inline也不行。好奇怪。
問題解答
回答1:只要給svg設(shè)置樣式 text-rendering='geometricPrecision' 就好了。
相關(guān)文章:
1. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題2. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.3. docker - 如何修改運(yùn)行中容器的配置4. python3.x - python連oanda的模擬交易api獲取json問題第五問5. nignx - docker內(nèi)nginx 80端口被占用6. css3 - 沒明白盒子的height隨width的變化這段css是怎樣實(shí)現(xiàn)的?7. javascript - webpack熱加載配置不生效8. javascript - QWebEngineView 如何爬 angular 的動(dòng)態(tài)數(shù)據(jù)?9. java - SSH框架中寫分頁(yè)時(shí)service層中不能注入分頁(yè)類10. java - instance method中 static后的<K>是什么意思?
