With developing a scheme to determine the thermal width of a pion in a medium, we investigate the shear and bulk viscosities and their ratios to entropy density. We calculate the temperature (T)-dependence of the pion mass and decay constant via the Dyson-Schwinger equations of QCD and get the pion thermal width with the QCD approach. We obtain then the T-dependence of the viscosities, especially a novel feature of the bulk viscosity, via the continuum QCD approach. The novel concavo-convex behavior of the bulk viscosity to entropy density ratio against the temperature is a demonstration of the QCD phase transitions.