gpt4 book ai didi

javascript - 隐藏文本中的特定单词而不添加新标签

转载 作者:行者123 更新时间:2023-12-03 07:02:32 26 4
gpt4 key购买 nike

我有这个代码:

<div>Lorem ispum custom test</div>

我只会隐藏而不删除“自定义”一词而不添加任何新标签。

我该怎么办?谢谢

最佳答案

您可以使用 mask 或剪辑路径。请注意,这不是一个可靠的解决方案,因为您需要根据字体属性和实际文本调整值:

.box {
/* the text to hide start at 90px and end at 137px */
-webkit-mask:linear-gradient(to right,#fff 90px,transparent 0 137px,#fff 0)
}
<div class="box">Lorem ispum custom test</div>

带剪辑路径:

.box {
/* the text to hide start at 90px and end at 137px */
clip-path: polygon(0 0, 90px 0, 90px 100%, 137px 100%, 137px 0, 100% 0, 100% 100%, 0 100%);
}
<div class="box">Lorem ispum custom test</div>

关于javascript - 隐藏文本中的特定单词而不添加新标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64858774/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com