After you use the short term losses for the year against any long term gain for the year you can use up to $3,000 of the capital loss to offset your ordinary income, such as dividends.
If your net capital loss is more than this $3,000 limit, you can carry the loss forward to later years to be used in the same manner in the later year.
See Topic 409 - Capital Gains and Losses for more details.
Ordinary dividends are ordinary income so only 3,000 of capital loss can be used to offset that type of dividend income.
Some mutual funds have capital gain distributions which will be fully offset by capital losses.
For a four percent dividend on 1M there would be 40,000 of income. If it is all ordinary income you would only be able to use 3,000 to offset the dividend income.
I hope this helps to clarify for you.