This NPR program is worth listening to. It tries to find what happened around 1984 to cause the anomalous drop in the graph below for women in computer science:
I'm sure other explanations are possible, but the one that program uses is a pretty credible one. It consists of looking at a particular time when computers became coded "male," a time when it first mattered that women and men beginning computer study courses at colleges had not had the same exposure to home computers.
Before that date most people had not had that exposure. After that date men were more likely to have had it*, and as practice matters, men then looked more competent in the introductory courses (which made more women consider themselves unsuitable for computer science). The reasons for the exposure difference is discussed in the program, but mostly it had to do with the societal coding of computing as male through advertisements, popular movies and so on.
Once that happened, that more female students dropped out of the computer science programs, that the programs became more male, those things would reinforce the initial gender coding and the cycle would then perpetuate itself. To find out how to break that cycle, listen to the program.
All this is interesting when trying to understand the problems women have in the IT industry. The change is fairly recent, after all. It's only thirty years since 37% of computer science graduates were women. Now that percentage is eighteen. But we regard the field as belonging to male geeks and nerds, as if that was based on eternal biological gender differences.
*The program does talk about access to computers by girls and boys during that era. It's likely that parents carried out some of the gender coding. It's not easy to figure out what happened. But some data suggests that boys' toys are more expensive than girls' toys. That could have made parents more hesitant to buy a computer for a daughter than a son. But it's also possible that girls didn't ask for personal computers, for whatever reason.