Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 21st, 2005, 12:52 AM
Wim Roffal
Guest
 
Posts: n/a
Default calculation with padding

Hi,

Can someone explain me how I can do calculations with padding.

I have something like elt.style.padding = "6px";

Now I want to calculate the size for a containing element. Something like:
container.style.width = 100 + (2 * elt.style.padding) + ""px";
This formula is accepted in Mozilla but crashes with IE.

I could of course get the padding of the elt, look if it contained px or em
or nothing as unitsize, strip the unit, etc. But I suppose that there must
be some function that can handle this for me.

Thanks,

Wim



  #2  
Old July 21st, 2005, 12:53 AM
Stan Brown
Guest
 
Posts: n/a
Default Re: calculation with padding

"Wim Roffal" <wimroffelplease@nospamm-planet.nl> wrote in
comp.infosystems.www.authoring.stylesheets:[color=blue]
>Can someone explain me how I can do calculations with padding.[/color]

In CSS, you can't.

If this is important, create your files as input to some
preprocessor that writes valid CSS as output. (This is what I do, in
fact, to get margins all equal when the text sizes are different.)

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles