Question: did croatia used to be part of hungary

Answer: Yes, The Kingdom of Croatia (Latin: Regnum Croatiae; Croatian: Hrvatsko kraljevstvo or Kraljevina Hrvatska) entered a personal union with the Kingdom of Hungary in 1102, after a period of rule of kings from the Trpimirović and Svetoslavić dynasties and a succession crisis following the death of king Demetrius Zvonimir. With the coronation of King Coloman of Hungary as ``King of Croatia and Dalmatia'' in 1102 in Biograd, the realm passed to the Árpád dynasty until 1301, when the (male) line of the dynasty died out. Then, kings from the Capetian House of Anjou, who were also cognatic descendants of the Árpád kings, ruled the kingdoms. Later centuries were characterized by conflicts with the Mongols, who sacked Zagreb in 1242, competition with Venice for control over Dalmatian coastal cities, and internal warfare among Croatian nobility. Various powerful nobles emerged in the time period, like Paul I Šubić of Bribir and Hrvoje Vukčić Hrvatinić, that secured de facto independence for their realms. The Ottoman incursion into Europe in the 16th century significantly reduced Croatian territories and left the country weak and divided. After the death of Louis II in 1526 during the Battle of Mohács and a brief period of dynastic dispute, both crowns passed to the Austrian House of Habsburg, and the realms became part of the Habsburg Monarchy.