gpt4 book ai didi

html - 有没有办法在html中的contenteditable div中设置插入符号高度

转载 作者:行者123 更新时间:2023-11-28 06:51:16 24 4
gpt4 key购买 nike

我需要处理像缅甸这样的语言,与其他语言(如英语)相比,它的字符要大得多。此后浏览器计算出的行高更大,插入符号部分超出了div边框。

所以我需要一种方法来使插入符号在不同语言之间保持其高度不变。就像你在同一行有缅甸语和英语,插入符号会在从左向右移动时保持 50px。或者你可以说我正在尝试找到一种方法来禁用浏览器计算插入符号高度的默认行为。

顺便说一句,这只处理 opera presto,它在 chrome 或 webkit 上表现良好。

最佳答案

我不认为我得到了最终的完美解决方案,但它确实是一种以某种方式解决这个问题的方法。

我用一个带有闪烁动画的子div来模拟浏览器的插入符号,并使父div成为一个纯div。这是 css 代码。

这是我认为对我有很大帮助的 Github 元素。 https://gist.github.com/navinpai/2902229

.cursor {
width: 1px;
height: 80px;

display: block;
position: relative;
margin-left: 30px;

animation-name: see_likes;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-timing-function: linear;
animation-play-state: running;
animation-delay: 0s;

-o-animation-name: see_likes;
-o-animation-duration: 1s;
-o-animation-iteration-count: infinite;
-o-animation-timing-function: linear;
-o-animation-play-state: running;
-o-animation-delay: 0s;
}

@keyframes see_likes {
0% { background: #0a0 }
47% { background: #090 }
50% { background: transparent }
97% { background: transparent }
100% { background: #090 }
}

@-o-keyframes see_likes {
0% { background: #0a0 }
47% { background: #090 }
50% { background: transparent }
97% { background: transparent }
100% { background: #090 }
}

关于html - 有没有办法在html中的contenteditable div中设置插入符号高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33751725/

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