gpt4 book ai didi

javascript - Cufon渲染换行符

转载 作者:行者123 更新时间:2023-12-01 17:11:25 26 4
gpt4 key购买 nike

过去一年半我一直在使用cufon,但从未见过...

说我有:

<h2 class="my_font">This is some text</h2>    
<p class="my_font">This is some more text</p>

文本已正确呈现,但换行符被呈现为新行,例如:
<h2 class="my_font"><cufon class="cufon cufon-canvas" alt=" " style="width: 5px; height: 16px; ">...</cufon</h2>

<cufon class="cufon cufon-canvas" alt=" " style="width: 5px; height: 16px; ">...</cufon>

<p class="my_font"><cufon class="cufon cufon-canvas" alt=" " style="width: 5px; height: 16px; ">...</cufon</p>

所以我最终在h2和p标签之间有16px的间隙。我唯一能够防止发生的事情是,将所有内容放在同一行上或注释掉换行符:
<h2 class="my_font">This is some text</h2><!--    
--><p class="my_font">This is some more text</p>

另外,我认为必须提及的是,在使用cufon的任何地方都会发生这种情况,这并不局限于上面的html示例。知道是什么原因造成的吗?

谢谢!

最佳答案

您的Cufon.replace('');代码是什么样的?

这可能是由于对大型父元素执行延迟替换而引起的,如下所示:

Cufon.replace('ul, div#foo');

相反,您应该更加具体,并针对容器内的特定元素,例如:
Cufon.replace('div#foo h2, div#foo span');

也许这不是您的问题,但我已经看到它是在这种方式之前发生的。让我知道。

关于javascript - Cufon渲染换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3514790/

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