English 中文(简体)
html inline node with text siblings misplacement
原标题:html inline node with text siblings misplacement

我有:

<span as="0" style="display: block; -webkit-user-select: text; ">
"[TEXT]"
<span id="as_cursor" style="padding: 0px; margin:0px; width: 0px;"></span>
"[TEXT]"
</span>

我使用内距作为标记,随后将坐标带上 j。 当这一期限与线末(如屏幕上所示,实际案文中无电子特性)相吻合时,外部要素(左边)的起步时间在起(左边)时,就会出现错误的抵消(0)。

Is there any way I can get around this behaviour? At present, only chrome and mozilla compatibility is required.

问题回答

你没有获得抵消的原因是,时间段是线性的。 为解决这一问题,在您的超文本页头部添加以下代码:

<style>
    .offsetFixed {
        display: inline-block;
    }

    #outerSpan {
        display: block;
        -webkit-user-select: text;
    }

    #as_cursor {
        padding: 0;
        margin: 0;
        width: 0;
    }
</style>

此外,对你的超文本作了以下修改:

<span class="offsetFixed" id="outerSpan" as="0">"[TEXT]"
    <span class="offsetFixed" id="as_cursor"></span>"[TEXT]"
</span>

然后,你可以利用 j子获得正确的抵消:

$(document).ready(function () {
    var offset = $("#as_cursor").offset();
    alert(JSON.stringify(offset));
});




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签