If you earn $12,000 to $261,000 then you can think of the standard deduction as subtracting the first $12,000 of income/gains/etc. If your income approaches certain "phase out" limits, your standard deduction starts to shrink below $12,000. A high income can reduce your standard deduction.
If you make $40,000 in income and $8,000 in LTCG (while filing as "single"):
(I personally prefer to view the standard deduction as happening first):
$40,000 income - $12,000 standard deduction = $28,000 left
$28,000 income - $9,525 first (0%) bracket = $18,475 left
$18,475 income - $18,475 second (12%) bracket = $0 left (room for $10,700 more)
$8,000 LTCG - $8,000 first (0%) LTCG bracket = $0 left (room for $2,700 more)
So in this example, $18,475 would be taxed using the 12% bracket (or tax tables really, which probably round up to the nearest $50 and cause $2,220 in tax).