-2

So I am working on a web project with other students and we are creating different parts of a web project.

I am having a problem whenever I link a teammates css file to my html document. The buttons are out of wack doesn't resize right...etc etc.

I read somewhere that if you have multiple css files linked the last one takes precedence. I tried that and it didn't help. I realized that there may be styles in my teammate's css file that are not in mine and that's whats causing the problem. Is there anyway to fix this issue without going through all the of my teammate's css file and trying to figure out what's causing the styling issues?

  • 1
    _if you have multiple css files linked the last one takes precedence_. No, just when the rules has the same priority. In other cases the rule with the highest priority wins, doesn't matter if it's linked as first or second. The rest of question is too broad without relevant code. See https://stackoverflow.com/questions/4072365/css-understanding-the-selectors-priority-specificity – pavel Nov 29 '17 at 06:57
  • No, there is no way but to go through all the styles one by one. If there are styles in the first CSS file that you need, but also styles that you don't need but are not currently overriding in the second CSS file, there is nothing you can do but to inspect the files manually. There are no automated tools you can use, because no tool will know what styles you want and what styles you don't want to keep. – Mr Lister Nov 29 '17 at 07:40

1 Answers1

1

CSS always applies based on the priority. Except debugging an element using dev tools, we do not have any other way to get rid of it.

Use !important if your CSS should override others and ask teammates not to use !important for the same CSS.

Also inline CSS overrides header CSS and header CSS overrides External CSS, in the absence of !important

nmkyuppie
  • 1,456
  • 1
  • 14
  • 30