This question is more out of curiosity than stuck. I know that the html id must be unique, and I see an error in the html validation. However, browsers are happy to apply style sheets to both elements. This is because they are more relaxed in parsing or what. Does this mean that I can use this for styling, etc. Or has side effects.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
#abc { color: red; }
</style>
</head>
<body>
<div id="abc">Hello Div 1</div>
<div id="abc">Hello Div 2</div>
</body>
</html>
Output in browsers.

source
share