Deadweight loss occurs any time a market fails to produce where the marginal benefit (demand) curve intersects the marginal cost (supply) curve*. That quantity is referred to as the socially optimal quantity and represents a market that is allocatively efficient.
Deadweight loss represents the amount of total surplus (consumer plus producer surplus) that society misses out on because it is not getting the socially optimal quantity.
In markets without externalities, per unit taxes cause the market quantity to drop below socially optimal, resulting in deadweight loss. The amount by which the quantity decreases is determined by the elasticity of supply and/or demand. The more elastic either curve, the greater the quantity response to the tax.
So, in situations where supply and/or demand is highly elastic, a per unit tax will cause a large reduction in market quantity and a larger deadweight loss.
*When externalities are present, deadweight loss occurs when marginal SOCIAL benefit does not marginal SOCIAL cost.