Back in the early days of the internet there was a reason to be concerned about consistency in how browsers displayed the colors. Many computer screens back then had 8-bit color displays, which could only display 256 different colors. The computer system itself uses some 40 colors, for menus and such, and the remaining 216 colors could be used to display the actual web pages.
Now, 216 colors might sound like quite a bit, but the problem is that no aesthetic considerations were made when these colors were decided, but rather they are based solely on mathematical formulas. To be more exact, the web-safe colors are what you get when you use 0%, 20%, 40%, 60%, 80% and 100% of the three different primary colors, and then mix these in every possible combination.
Below are all the websafe colors, along with their hexadecimal values.