'responsive @media query to remove style declarations

I'm unfamiliar with @media queries, and what I'm trying to accomplish is a responsive removal/alteration of certain CSS when the browser viewing is shrunk below a certain resolution, or a mobile device viewing the page is also below that same specified resolution.

I need .side to remove float: left; position: fixed; width: 150px; when below 500px width resolution, and .main to remove border-left: 1px solid #000; margin: 0 0 0 170px;

.side {
  display: block;
  float: left;
  overflow: hidden;
  position: fixed;
  width: 150px;
}

.main {
  border-left: 1px solid #000;
  margin: 0 0 0 170px;
}

Any help or explanation is appreciated.



Solution 1:[1]

.side {
  display: block;
  float: left;
  overflow: hidden;
  position: fixed;
  width: 150px;
}

.main {
  border-left: 1px solid #000;
  margin: 0 0 0 170px;
  width: auto;
}
@media only screen and (max-device-width : 500px) {
  .side {
    float: none;
    position: static;
    width: auto;
  }
  .main {
    border: 0;
    margin: 0;
  }
}

Solution 2:[2]

There is a pretty simple way to do it, just use all: unset, like this

@media ("your condition") {
   .yourClass {
      all:unset
   }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Neithan Max
Solution 2 PMichaell