0

Possible Duplicate:
Using Javascript in CSS

I am developing an android app from Phonegap. I need to set the width of a container relatively: find the width of a container and set width of the required container in proportion to it. I can do this easily in JavaScript. But i need to do this in CSS code, is there any simple way of doing this?

Community
  • 1
  • 1
Sujan Shrestha
  • 191
  • 1
  • 4
  • Yes it's possible, IE and Firefox both support something in that direction. NO don't use it. It isn't a mainstream accepted functionality and it's a dirty solution to your problem. Can't you have an external JavaScript file to solve your problem? – Ruben-J Nov 12 '12 at 07:20

2 Answers2

1

Try LESS dynamic stylesheet language: http://lesscss.org/

karaxuna
  • 26,752
  • 13
  • 82
  • 117
1

As suggested, less can do it, but I presume that isn't an option because it requires rethinking your entire styling approach.

There is a link given in a comment, but my advice to you is - it is way too complex to be done the way you wish. You should probably rethink the approach to alter the property directly with javascript.

IT would be the cleanest solution.

tonino.j
  • 3,837
  • 28
  • 27