首页 > 解决方案 > 样式“text-stroke”是否有任何 document.execCommand()?

问题描述

我正在尝试使用 document.execCommand('') 来制作一个文本编辑器,我希望用户能够在其中以不同颜色勾勒(描边)文本。就像下面的代码:

    <p style="-webkit-text-stroke-width: 1px;
  -webkit-text-stroke-color:rgb(125, 255, 136); font-size:40px;">Text Sample</p>

我希望用户在单击按钮时执行此操作。

喜欢设置字体颜色,我们使用:

document.execCommand('color', false, color);

我想要文本笔划的类似功能。

$('stroke').click(()=> {
    document.execCommand('command_for_the_text_stroke??', false, color)
}) // this is the format

如果您能提供帮助,那就太好了。祝你有美好的一天!

标签: javascriptjquery

解决方案


推荐阅读