3

So, I need a way to so that a CSS class is only used by desktops (Normal Screen). Eg:

.class {
  position: fixed;
}

Is only used on desktops.

Bryan Ash
  • 4,221
  • 3
  • 38
  • 56
SYS
  • 33
  • 1
  • 3
  • Check this entry http://stackoverflow.com/questions/6666907/how-to-detect-a-mobile-device-with-javascript there you could find the way in the answers – Oldskultxo Jan 24 '16 at 00:37

1 Answers1

5

Although it's not desktop specific, you can limit it to the screen based on the screen size with a media rule around it, like so:

@media screen and (min-width: 640px) {
    .class {
        position: fixed;
    }
}

This would limit your rule to only be applied if the monitor was at least 640 pixels wide, larger than a smartphone (today, anyway).

argoc
  • 303
  • 1
  • 11