Generally:
In criminal cases fees are charged hourly (contingent fees not allowed)
In civil cases, fees can be charged hourly or on a contingency basis. If contingency, the lawyer gets a % of the award to the plaintiff ( contingent fees not allowed in most family law matters)