如何获得线框的高度,一个块元素,内置的内部元素,在渲染时 [英] how to get the heights of line-boxes a block element, with inline elements inside, is made of when rendered
问题描述
有可能知道行框中的内联元素的块元素已被分解吗?这对于html专家来说是一个难题,但您可以在这里看到我的意思: http://bit.ly/6EMfet在内联流段落。
Is it possible to know the line-boxes a block element with inline elements inside has been broken up? This is a hard question for html experts but you can see what I mean here: http://bit.ly/6EMfet at "Inline flow" paragraph. I need to have the heights of each line-box the block ended up being made of at rendering time.
推荐答案
element.getClientRects应该是答案。我试过它在一个WebBrowser控件在c#应用程序,它似乎工作,但我尝试了在一个WebView在Android应用程序,它只产生只有一个rect。我发现在Android上我可以成功使用{range = document.createRange(); range.selectNode(element); rects = range.getClientRects(); },它产生有用的矩形数组(注意:第一个矩形是边界矩形)
element.getClientRects should be the answer. I tried it in a WebBrowser control in c# application and it seems to work but I tried it in a WebView in Android application too and it yields just 1 rect. I found that on Android I can successfully use {range = document.createRange();range.selectNode(element); rects=range.getClientRects(); } which yields the useful array of rects (note: the first rect is the bounding rectangle)
这篇关于如何获得线框的高度,一个块元素,内置的内部元素,在渲染时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!