Deductions & credits

Can I offset ordinary income with $10,000 of short-term capital losses if I have $20,000 in long-term capital gains that year? Or am I only allowed to offset ordinary income with NET capital losses. If the latter, it seems like I wouldn't be able to offset ordinary income in the situation described above, since I don't have net capital losses (I have a $10,000 net capital gain).