DOM tests - offset

Offset information

BTW: This div has position: relative.

BTW2: script does not work on textarea because of mobile phone funkiness.

On this page I test the offset.

Click on any element. The target of your click event looks like this, while its direct offsetParent looks like this.

Tests

This is a paragraph in a div with position: static.

This is a paragraph in a div with position: relative.

This is another paragraph in a div with position: relative, but now the paragraph itself has position: relative, too.

This is a TD

This is a paragraph in a TD

This is a TD

This is a paragraph in a TD

This is a TD

This is a paragraph with position: relative in a TD

Let's NEST! All surrounding divs have position: relative.

A div with position: fixed.

An absolutely positioned test paragraph for offsetX/Y. Click on the left foot of the first A. Border and padding are both 5px, so (assuming you click on the very edge of the content area) offsetX should return 5 (relative to padding box). If it’s measured relative to the content box the browser returns 0; if relative to the border box 10.