0

I would like to ask how i going to insert stylesheet style with media query by using jss.js. Currently i am using code below to insert style with class, but i wonder how to insert style with class with media query ?

jss.set('.demo', {
        'font-size': '15px',
        'color': 'red'.
        'background' : '#000'
    });

The Jss plugin https://github.com/Box9/jss

Js fiddle link example http://jsfiddle.net/L8wvuonq/1/

I would appreciate if anyone can help. I really need to insert style with media query by using stylesheet or others way which can insert and retrieve style rules so that i can compile together.

Thanks.

  • 1
    please, at least post valid sample code – A. Wolff Dec 20 '14 at 09:56
  • you should just insert a style tag: http://stackoverflow.com/questions/524696/how-to-create-a-style-tag-with-javascript I don't find any need for using this plugin, really – A. Wolff Dec 20 '14 at 10:04
  • for some reason, i must use stylesheet to append the css rules which can be dynamic retrieve and delete. From the link u give, it only can be append to head and just insert, how i going to retrieve and delete or update ? – user3576381 Dec 20 '14 at 11:13
  • You could just set specific ID (or class or whatever) for this `style` tag and remove it, modificate it or whatever. Or you could change element(s) attributes as class to no more react to specific CSS rules, etc... You'd have better to explain why would you need to use this plugin? Because actually, i see no point in using it – A. Wolff Dec 20 '14 at 11:14
  • to retrieve CSS rules specific to any element: http://stackoverflow.com/questions/754607/can-jquery-get-all-css-styles-associated-with-an-element – A. Wolff Dec 20 '14 at 11:20
  • I still developing a web apps similar to this website: http://froont.com/ basically it's allow ppl simply add and modify html and css element without writing single code. and nw i stuck in the insert rules in media query, i found a article teaching the similar things, but it's not work: http://davidwalsh.name/add-rules-stylesheets I can't find others related articles(insert rules in media query)... – user3576381 Dec 20 '14 at 14:08

0 Answers0