1

I have a class called .nav ul li ul working before using @media screen, When I work on media screen I want to disable this class (Don't want css to read it anymore). Is there anyway to do this? Example

.nav ul li ul {
  padding: 0;
  position: relative;
  top: 40px;
  left: -30px;
  width: 200px;
}

@media screen and (max-width: 600px) {

.nav ul li ul {
  Do not do anything, Just ignore the original class
}

}

Please note that I still want to display this class But I don't want to give it any properties. Thanks

user2044626
  • 281
  • 1
  • 6
  • 18

2 Answers2

2
@media screen and (max-width: 600px) {
    .nav ul li ul {
      padding: 0;
      position: relative;
      top: 0px;
      left: 0px;
      width: 0px;
    }
}

This should reset all the properties previously set.

Reset/remove CSS styles for element only

That link is to a question that has many default property values for css, as there is currently no built in way to reset it to a default.

Community
  • 1
  • 1
Wolfie
  • 1,369
  • 8
  • 16
1

What you can do is you can either recopy the same properties:

@media screen and (max-width: 600px) {

.nav ul li ul {
  padding: 0;
  position: relative;
  top: 40px;
  left: -30px;
  width: 200px;
}

or just simply don't write that part. It actually worked on the times when I try it.

Xtian
  • 508
  • 2
  • 6