0

Inspected CSS

It's an SVG (in img tag) thats held inside a div, for some reason the @media only screen and () CSS wont overwrite the previous CSS rules. And i have no clue why this is, could someone please explain/give a solution?

Johannes
  • 64,305
  • 18
  • 73
  • 130
  • 4
    Please share your code in text. Not a screenshot. – TidyDev Nov 09 '18 at 16:21
  • Quick fix: Add `!important` next to the properties or change the order of the queries – Fusseldieb Nov 09 '18 at 16:26
  • 3
    Possible duplicate of [Why does the order of media queries matter in CSS?](https://stackoverflow.com/questions/8790321/why-does-the-order-of-media-queries-matter-in-css) – Blackbam Nov 09 '18 at 16:28

2 Answers2

2

Your @media query is above the style you're trying to overwrite.

In CSS, if it's defined multiple times, the later/more specific one wins.

Nieminen
  • 1,284
  • 2
  • 13
  • 31
2

Your screenshot also shows the lines of the stylesheet in which these rules are written: The regular rule is in line 131, the media query rule in line 63. According to this the regular rule is after/below the media query, so it overwrites the media query, since it applies to everything. Just change the order in your stylesheet.

Johannes
  • 64,305
  • 18
  • 73
  • 130
  • Thanks for the reply! :) This solved my problem, and i never knew the order mattered that much since i've never had this problem before (i always put "@media" first, then everything else). – Julien Peeters Nov 09 '18 at 17:06