Has anyone done same to her , any older siblings or family she may be copying is she is she in day care, I ask this as very often children show learned behaviors .I think the way to stop it is to ignore it, when she does it say nothing ,it could be she has found it gets her attention.I have always found distraction works well with this age, when she starts to get upset and hit herself put some music on or start to sing or make some distracting noise , get a favorite toy even dance around the room , that always distracts children and ends up being fun. My dd used to bash her head on the side of the crib, I padded it, but I also made sure that I took no notice of her, it soon stopped.Good luck