The best way to ensure that a website works properly on all devices, operating systems and browsers is to code it following the recommended W3C standards.
The W3C is the group/body who oversee and rationalize the code that is used to write websites. Browser manufacturers then use this standard to write their browser (Internet Explorer, Google Chrome, Firefox etc.) software so that it knows how to correctly display a modern website. It is perfectly possible to write a website that barely follows that standards at all but still works on a particular system or browser but this will only be due to a very forgiving browser correcting the mistakes in the code on the fly and there is every chance that the site will eventually break when the browser is updated or will not work on other browsers or devices. Once upon a time 90% of internet users were on Windows and used Internet Explorer but this is far from the reality today and the number of devices and browsers in the world is only going to keep getting more diverse.
This is why browser manufacturers now all follow a centralized standard and it is important that these standards are also followed in creating your website.