Some web design software uses 3-digit color codes, but I've discovered that the easiest way to manipulate colors in CSS is to use Photoshop, which generates 6-digit codes. Open the Color Picker and mix up your perfect shade. Just to the right of the spectrum, you'll see a box with two colors in it: "New" and "Current." If the color you've selected isn't in the CMYK gamut, a small box of color will show up just to the right with a caution symbol. This means that the color can't be printed with CMYK inks. If you're just using the color on the web, this doesn't matter. But if you're also printing stuff, you should click on the little box and it'll change the color to something that can be printed with the cyan, magenta, yellow, and black (C, M, Y, K) inks that printers use.
You might also see a small color box with a grey cube drawn in perspective above it. This means the color you've selected isn't web-safe. Click on the color box to change it to the closest web-safe color. Once you do, the six-digit formula for the color appears at the bottom of the first column of numbers, just after the "#" sign. Copy this formula and paste it into your CSS to color your text or other website elements.