Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can CSS perform maths: width= 100 - 200 1

Status
Not open for further replies.

gwar2k1

Programmer
Apr 17, 2003
387
GB
Hey just wondering if theres a way to have a stylesheet dynamically work out 100% width minus 200px. Ive tired
{width: 100% - 200px;} and it didnt work. Any one know of a way?

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
Try {width:expression(100%-200px);}

Hope it works :p

----------
I'm willing to trade custom scripts for... [see profile]
 
=) Thanks. It kinda works:

I have a div width 200px float left and another float right using expression(100% - 200px) so in theory this should fill the screen right?
yeah it works... the left div is fine, the right div floats right but isnt 100%... id say maybe 400px wide (1024x768 resolution).

Any ideas? TIA

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
Could try document.body.offsetWidth or similar (see below) instead of 100% but not sure it would help :(

I experienced a similar problem but cannot remember the fix. In my case it was only slicing +/-30px off the width of the page which was very anoying.

Remember trying lots of things without success including clientWidth, offsetWidth, margins, borders, scrollbars... :(

----------
I'm willing to trade custom scripts for... [see profile]
 
thanks =) i think its to do with whats in the div actually. gonna sort that out then if its still wrong, ill try out your alternatives. thanks again =D

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
cool it was just the content inside teh div so your first reply worked just fine. thanks!

remember kids: always close your open tags

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top