The same investment can be both a capital gains and an ordinary income property. Whether it's stocks, real estate or business assets, the test is what you do with it, not anything inherent in the asset itself. When it generates income for you, it's an ordinary income property. When you sell it, it's usually capital gains property.
Ordinary Income Property
Stocks that pay dividends on your investments or a rental house that generates money from tenants are both examples of ordinary income property. You pay tax on the income at the same rate as if you'd earned it at your job. You often have more forms to fill out when you get your income from different sources; for example, you fill out Schedule E to report rental income. Otherwise the IRS treats your income much like your wages.
Capital Gains Property
When you sell stocks, real estate or other assets, you have to treat it as capital gains property, even if it's been earning you income. If you held the property less than a year, the IRS taxes your capital gains income from the sale at the same rate as your regular income. Hold it longer than 12 months and you often pay a lower rate, the so-called long-term capital gains rate. The higher your top marginal rate, the more you benefit from paying long-term versus short-term capital gains.
If your rental property runs in the red, you can't usually write off the loss against your non-rental income. The exception is if you actively manage your property -- arranging repairs, advertising vacancies, vetting tenants -- rather than hiring a manager to do all that. If you're actively involved, you can write off up to $25,000 in losses from your salary or self-employment income. If you can't write off a loss, you can carry it over to next year, so it should lower your taxes eventually.
If you have a capital loss instead of a capital gain, you first write it off against the your other capital gains. Then you get to deduct up to $3,000 in losses against your ordinary income, or $1,500 if you're married filing separately. Like losses on rental income, you get to carry over any unused loss to the following year. For capital losses, you can keep taking deductions for as many years as it takes to fully write off the loss.