A cosmetic agent for the temporary styling of keratinic fibers, in particular human hair, containing, in a cosmetic support, with respect to its total weight, a) from about 0.05% to about 5.0% by weight of at least one (meth)acrylamidopropyltrimethylammonium salt homo- or copolymer (Polyquat-47); b) from about 0.5% to about 10% by weight of polyimide. Most preferably component a) is either 3-(acrylamidopropyl)trimethylammonium chloride or 3-(methacrylamidopropyl)-trimethylammonium chloride. As embodied, the polymimide may be polyimide-1. The composition may further comprise: surfactant (non-ionic, amphoteric, cationic); wax; non-ionic polymer distinct from component b); polymeric thickening agent; water or water-alcohol mixture; propellant (e.g. propane and/or butane). Also claimed Is the use of the composition for temporary styling of, straightening of, improving the hold of, improving the combability of a hairstyle or collection of keratinic fibres. Also claimed is a method of temporarily shaping cosmetic fibres comprising use of the composition.