I recently went through my CSS file and switched all my six-digit hexadecimal codes to simple three-digit codes (for example, my #FDFEFF
got shortened to
That is true, but this transformation is not general:
#FFF == #FFFFFF
#CCC == #CCCCCC
So it "doubles" each hexadecimal digit. So it is not the same color. It is however possible that it looks the same because the differences are minute. A calibrated color workflow could help in this case.
Shorthand sucks! Don't use it. It's harder to maintain and creates unnecessary variation e.g. when searching and replacing a colour value ("oh, now I have to take into consideration #FFFFFF
and white
and #FFF
").
What you save in size is never worth what you lose in maintainability. Use minifaction and compression to save bandwidth.
The three-digit codes are a shorthand, and #123
is the same as #112233
. In the example you give, you've (effectively) swapped #FDFEFF
for #FFFFFF
, which is close to the original colour, but obviously not exact.
It doesn't "matter" which version you use, as such, but three-digit colour codes mean you have a little less choice in shades. If you feel that saving 300 bytes is worth that, then go ahead and use the three-digit codes, but unless you're designing for a low-bandwidth situation those 300 bytes won't really save you all that much.
If the "3 digit" versions produces the colour you need then you can use it as much as you like. It's certainly not wrong.
It does not matter whether you use shorthand or normal hex colours, so go ahead and convert them if you desire.
removing them saved me an entire 300 bytes in my CSS file
Wow, a full 300 bytes! :D, sarcasm for the win
The thing is, unless you're going to minify, compress and combine all of your CSS, JavaScript, etc. content, 300 bytes is barely worth bothering with, especially as the average Internet speed is increasing.
If you want to save bytes then you better use CSS minification techniques