If two CSS declarations affect the same element but they conflict, which one wins?
CSS:
body {
background: rebeccapurple;
}
body {
background: grey;
}The cascade algorithm uses the following to decide which rules are applied when there's a conflict:
In decreasing order of importance:
style attribute<p style="color: grey;"></p>
<style> element<style>
p {
background: rebeccapurple;
}
</style>
<link rel="stylesheet" href="styles.css">
In decreasing order of selector importance:
See the Specificity Calculator
When there's still a tie, the declaration that comes last in source order, wins.
When in doubt, inspect!

The Inspector will order all declarations from highest to lowest precedence.