example: $('yourElemID').setProperty('prop-name', 'class-name');
3 general ways to do that:
1. element.setProperty('property-name', 'class-name' )
2. element.addClass('class-name' )
3. element.className = 'class-name'
You can set what ever css rule you want to for those elements you
want, such as height: someValue, width: someValue
On Oct 4, 1:42 pm, Rolf Langenhuijzen <[email protected]> wrote:
> What is the smartest way to dynamically create a css style/class that
> I can insert in the page an (re-)use?
>
> I'm working on some layout stuff that requires calculating & applying
> of width/height settings to elements, but I want to add additional
> styles for media queries/browser sizing and rather create some css
> classes on the fly when the script runs. Then add those classes to
> elements (or parent), rather than doing calculations all the time and
> adding width/height style properties.
>
> Cheers,
> Rolf