This hair cosmetic which comprises components (A)-(E), wherein the mass ratio (A)/(E) of component (A) with respect to component (E) is not less than 0.05 but less than 2. (A) A compound represented by general formula (1), or a salt thereof. (1) [In the formula, the broken line represents presence or absence of a π bond, R1 represents a hydroxyl group or an acetoxy group, R2 represents a hydrogen atom or -COOR (R represents a hydrogen atom, a methyl group, or an ethyl group), and R3 represents a hydrogen atom, an acetyl group, a methyl group, or an ethyl group.] (B) Alkaline agent (C) Buffer (D) Anionic surfactant (E) Cationic polymer having a cationic charge density of 0.01-4.8 meq/g.