ABC is blue size 10 XYZ is blue size 12 123 is red size 12
XYZ is still blue because it's still within div#2. But it's not within div#3 which is closed - so it is size 12, not 10.
By the way, I assumed you meant div#1 and not div.1 Also note, it is not a good idea to begin a class or ID name with a numeral. Older versions of IE will (incorrectly) forgive it but not other browsers.
You may be running into issues around CSS specificity [google.com] - which bothers me and most everyone I know from time to time. The link I gave points to our Site Search results on the topic - and it's worth some time getting up to speed. In short, there are complex rules in CSS about when one rule overrides another.
But the general answer is still, if the div is open then its rules are in effect - however some other specificity factor may also be in play in any particular situation.