I understand that IDs are supposed to be unique in HTML documents. But a lot of HTML pages are sloppy and don\'t follow the rule. My question is: how do browsers handle CSS
You're right as far as CSS "pretty" display goes, the error recovery is to apply the CSS as if it were a class.
What can be unintended consequences in CSS layout due to sharing of same id amongst multiple elements?
Not much to the actual CSS layout, as mentioned above but..
you might not be able to specifically target (isolate an element) if you need to, and/or the specificity of a selector needed to override a CSS rule with an ID already in it could only be done by adding a unique ID further up the ascendency (or adding an inline )
also don't think you'll get on very well if you need to use jQuery or something like that, Javascript relies on the ID's for best functionality
ID's are also Fragment Identifiers - they won't work too well if they're not unique