Javascript examples for DOM HTML Element:Style
Generating CSS media queries with javascript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> p {//from www . ja v a2 s .co m color: blue; } </style> <script type="text/javascript"> window.onload=function(){ document.querySelector('style').textContent += "@media screen and (min-width:400px) { div { color: red; } }"; } </script> </head> <body> <p>blue</p> <div> red </div> </body> </html>