Thats the thoery. Well sort of.
A baby's gender is determined by the chromosomes in the sperm, not the egg. XX makes female, XY makes male, all eggs contain an X chromosome, so sperm donates other X or Y chromosome.
Female sperm live up to 5 days, male sperm up to 3 days. (Egg lives 12 to 24, maybe even 36 hours after ovulation.) Female sperm live longer but swim slower than male sperm. (Vaginal environment supposedly contributes to sperm longevity, alkaline/acidic - male sperm prefer baking soda douche prior to sex, female prefer acidic (vinegar) (supposedly) - but most importantly of all, male swim quicker, so for male baby, have sex within 6 hours before ovulation, to beat female sperm to egg. Vice versa, for female baby, have sex 4-5 days before ovulation, for better chances of having a girl baby.
(from wiki answers)