Get the current offset position of a p element:
The offset() method set or returns the offset (position) for the selected elements, relative to the document.
Returns the offset coordinates of the FIRST matched element.
This method returns an object with 2 properties, top and left, which represent the top and left positions in pixels.
Sets the offset coordinates of ALL matched elements.
| Parameter | Description |
|---|---|
| value | Required. Specifies the top and left coordinates in pixels. Possible values:
|
Using a function to set the offset coordinates of ALL matched elements.
| Parameter | Description |
|---|---|
| function(index,oldoffset) | Specifies a function that returns an object containing the top and left
coordinates.
|
Set
an offset position for an element using an object
How to set the offset position for an element using a new object.
Set an offset
position for an element using the offset position of another element
How to set the offset position for an element using the offset position of an existing element.
| WEB HOSTING |
|---|
| Best Web Hosting |
| PHP MySQL Hosting |
| Best Hosting Coupons |
| UK Reseller Hosting |
| Cloud Hosting |
| Top Web Hosting |
| $3.98 Unlimited Hosting |
| Premium Website Design |
| WEB BUILDING |
|---|
| XML Editor - Free Trial! |
| FREE Website BUILDER |
| Best Website Templates Top CSS Templates |
| CREATE HTML Websites |
| EASY WEBSITE BUILDER |
| W3SCHOOLS EXAMS |
|---|
|
Get Certified in: HTML, CSS, JavaScript, XML, PHP, and ASP |
| W3SCHOOLS BOOKS |
|---|
|
New Books: HTML, CSS JavaScript, and Ajax |
| STATISTICS |
|---|
|
Browser Statistics Browser OS Browser Display |
| SHARE THIS PAGE |
|---|