I am attempting to use style.top for a div element that exists in the root of the body tag. but its idea of where top = 0 is about 40 pixels out. i have tried adding border=0 and padding=0 to the style of the body tag but it doesnt work.

Can anyone make any suggestions? Cheers

try

{margin: none; border: none; padding: none;}

You need all three, because different browsers have different default styles for both body and div. Apply these styles to both the body tag and the div inside. If you need padding inside the div tag, nest another div inside it and put the padding style there.

Also the name for this is vertical-align: top; And vertical align doesn't always work right if padding is in the same object's style.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.