I have always thought that if a property was defined after the previous property [...] that it would overwrite the previous value.
This is only true if these selectors have the same specificity.
Actual Specificity
input[type=button] /* specificity = 11 */
.accent /* specificity = 10 */
Imagine
<input type="button" id="id" class="class">
#id {}
.class {} /* will of course never ever override #id */
#id.class {} /* will override as well */
Each selector has his points that get summed up when combined.
There is also a nice "hack" if you must increase your selectors specificity:
.class {} will be overridden by .class.class {}
input[type=button] {
color: red;
background-color: transparent;
}
.accent.accent {
color: white;
background-color: blue;
}
<input type="button" value="Hello" class="accent">
Nice read anyway: https://css-tricks.com/specifics-on-css-specificity/
BTW I remember there is a very good website where you can read exactly how many points each selector has (id is strongest) but I can't find the resource anymore...
EDIT
Calculating Specificity
* /* a=0 b=0 c=0 -> specificity = 0 */
LI /* a=0 b=0 c=1 -> specificity = 1 */
UL LI /* a=0 b=0 c=2 -> specificity = 2 */
UL OL+LI /* a=0 b=0 c=3 -> specificity = 3 */
H1 + *[REL=up] /* a=0 b=1 c=1 -> specificity = 11 */
UL OL LI.red /* a=0 b=1 c=3 -> specificity = 13 */
LI.red.level /* a=0 b=2 c=1 -> specificity = 21 */
#x34y /* a=1 b=0 c=0 -> specificity = 100 */
#s12:not(FOO) /* a=1 b=0 c=1 -> specificity = 101 */
Reference: https://www.w3.org/TR/css3-selectors/#specificity