HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> body{ color:red; } </style> </head> <body> <h1>CSS @media Rule</h1> <button onclick="myFunction()">Set max-width @media property</button> <script> function myFunction(){ var styles = 'body{ color:blue;}'; var styleSheet = document.createElement("style"); styleSheet.type = "text/css"; styleSheetelegram.dogdia = "screen and (max-width:630px)"; styleSheet.innerText = styles; document.head.appendChild(styleSheet); } </script> <p><strong>Note</strong>: Try to resize the output window before and after clicking on the button (to set max-width @media property)</p> </body> </html>
OUTPUT
×

Save as Private