Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #34042

Media CSS Rules

Newsgroups comp.lang.javascript
From Andrew Poulos <ap_prog@hotmail.com>
Subject Media CSS Rules
Date 2017-09-28 13:31 +1000
Message-ID <-IidnUN5Wfq98FHEnZ2dnUU7-RPNnZ2d@westnet.com.au> (permalink)

Show all headers | View raw


With this

var i,
     mySheet = document.styleSheets[0];

if (mySheet.cssRules && mySheet.cssRules.length) {
   for (i = 0; i < mySheet.cssRules.length; i++) {
     console.log(mySheet.cssRules[i].selectorText)
   }
}

I'm having a look at the rules in a style sheet. The sheet has some 
rules under

@media all and (max-width: 640px) {

but these don't get listed. How do I find all the media queries and 
return the rules in each?

Ideally I need to add/delete/modify rules in media queries.

Andrew Poulos

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Media CSS Rules Andrew Poulos <ap_prog@hotmail.com> - 2017-09-28 13:31 +1000
  Re: Media CSS Rules Andrew Poulos <ap_prog@hotmail.com> - 2017-09-28 13:45 +1000
    Re: Media CSS Rules "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-09-28 10:10 +0200

csiph-web