Have you ever wondered about the way browsers handle CSS properties within the same rule? The topic of rules precedence has been discussed at length, but this specific question focuses on the execution order by the browsers.
In my view, I have always assumed that properties of a rule are executed in a sequential order by the browser.
Take for example,
#somediv {
margin:0;
margin-bottom:10px;
}
This code snippet is typically interpreted as margin:0 0 10px 0;
instead of margin:0;
in most modern browsers (such as Chrome, Firefox, and Safari). This means that the second property margin-bottom
takes precedence over the initial margin
property that sets all margins to be 0
.
But can we confidently state that this behavior holds true across all browsers, including Internet Explorer?