Let's look at the following example.
<html> <head> <style> .carlist { background-color: red; height: 30px; margin: 10px; margin: 20px; } </style> </head> <body onload="loadCars()"> Check div style. <div id="mydiv" class="carlist"></div> </body> </html>
In the above example, we declared 2 fields. I checked and found that the 2nd declaration is accepted by the browser (FF, IE, Chrome). Therefore, I think that if we use this for browser compatibility, then the most browser-specific style should be declared. But there are other ways to define browser styles. Therefore, it is better to have one attribute.
source share