Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / September 2004



Tip: Looking for answers? Try searching our database.

calculation with padding

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wim Roffal - 26 Sep 2004 16:44 GMT
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
Stan Brown - 26 Sep 2004 17:30 GMT
"Wim Roffal" <wimroffelplease@nospamm-planet.nl> wrote in
comp.infosystems.www.authoring.stylesheets:
>Can someone explain me how I can do calculations with padding.

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.)

Signature

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/

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.