offsetLeft vs left
Moderator: General Moderators
offsetLeft vs left
What's the diference between element.style.left and element.offsetLeft?
*sigh*... What diference do they have programmaticly?
Edit: Man, do you not get what I'm asking? Yeah ones CSS and the other isn't. But what does that tell me?
Edit2: I noticed that CSS' left is 0 even if the element is centered in the screen because the attribute was not set. I assume offsetLeft is not the same in that way?
Edit: Man, do you not get what I'm asking? Yeah ones CSS and the other isn't. But what does that tell me?
Edit2: I noticed that CSS' left is 0 even if the element is centered in the screen because the attribute was not set. I assume offsetLeft is not the same in that way?
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
"One is CSS left" means the amount that was specified as "left" in "CSS". Not usually that useful.
The other is problematic at best. If it's important to have a cross-browser solution that works, use prototype. (or at least learn from the offset code they use)
The other is problematic at best. If it's important to have a cross-browser solution that works, use prototype. (or at least learn from the offset code they use)