Coder Social home page Coder Social logo

文字渐变不支持 about modern-screenshot HOT 5 CLOSED

qq15725 avatar qq15725 commented on September 26, 2024
文字渐变不支持

from modern-screenshot.

Comments (5)

jianghai avatar jianghai commented on September 26, 2024

怀疑是 chrome 升级导致
给 dom 设置 webkitBackgroundClip ,比如 document.body.style.webkitBackgroundClip = "text";
会自动去除 webkit 前缀,但是 chrome 渲染还是正常

from modern-screenshot.

qq15725 avatar qq15725 commented on September 26, 2024

可以尝试先升级 modern-screenshot 到最新版试试, 最新版文字渐变应该是正常的

from modern-screenshot.

jianghai avatar jianghai commented on September 26, 2024

可以尝试先升级 modern-screenshot 到最新版试试, 最新版文字渐变应该是正常的

不行,手动 css 加了 -webkit-background-clip: text 后截图正常

from modern-screenshot.

qq15725 avatar qq15725 commented on September 26, 2024

通过 JS 设置 style.webkitBackgroundClip 好像是不行,具体我也不清楚(浏览器行为),我这边处理也是手动加
class 以保证这个特性

目前应该只能支持通过 CSS 的 -webkit-background-clip: text

  1. 使用 JS 添加 class
  2. 使用 CSS

from modern-screenshot.

jianghai avatar jianghai commented on September 26, 2024

通过 JS 设置 style.webkitBackgroundClip 好像是不行,具体我也不清楚(浏览器行为),我这边处理也是手动加 class 以保证这个特性

目前应该只能支持通过 CSS 的 -webkit-background-clip: text

  1. 使用 JS 添加 class
  2. 使用 CSS

那不应该有问题,库已经做了适配了

from modern-screenshot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.