Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Padding and Border size

0 views
Skip to first unread message

Frank Salem

unread,
Jul 15, 2008, 5:21:42 AM7/15/08
to

Sir/Madam:

Can someone help with this code below? I create two divs namely bodyDiv
and mainDiv. mainDiv
was appended to the bodyDiv. I set the same width for the two. Now, my
problem is that when I
add padding and border for the mainDiv, it got an unpleasant look The
mainDiv seems to react only
to the paddingTop and paddingLeft but not for the paddingRight, it was
being pushed to the right
of the mainDiv/bodyDiv. paddingRight seems to be not working. What
should I do with it? Should I adjust
also the width of the mainDiv because of padding and border?

Here's the code:

mainDiv.style.paddingTop=Math.round(bodyDiv.offsetWidth*0.010)+"px";
mainDiv.style.paddingLeft=Math.round(bodyDiv.offsetWidth*0.010)+"px";
mainDiv.style.paddingRight=Math.round(bodyDiv.offsetWidth*0.010)+"px";
mainDiv.style.border=Math.round(bodyDiv.offsetWidth*0.009)+"px solid
#000000";
mainDiv.style.width=Math.round(bodyDiv.offsetWidth)+"px";

This code work only IE6 but not on Firefox and IE7...

Please help!

Thanks in advance!!!


Dave Anderson

unread,
Jul 15, 2008, 6:00:18 PM7/15/08
to
"Frank Salem" wrote:
> ...mainDiv.style.width=Math.round(bodyDiv.offsetWidth)+"px";

>
> This code work only IE6 but not on Firefox and IE7...

Define "work". Does the Firefox Error Console indicate an error?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Frank Salem

unread,
Jul 15, 2008, 10:01:07 PM7/15/08
to

What I mean is that it "work properly" only on IE6 but on FF, the mainDiv
is being pushed to the right side.
Thanks!

"Dave Anderson" <NPQRWP...@spammotel.com> wrote in message
news:C66dnV1U-ZxogODV...@posted.visi...

0 new messages