After the death of Heinrich III in 1056 AD, and with the help of the king of Poland, the Popes felt strong enough to try to break away from the control of the Holy Roman Emperors. Under Heinrich IV, the Popes insisted that priests and bishops served only the Pope and could not be appointed by the Emperor. Heinrich IV wanted to appoint his own bishops who would help him rule his empire, but the Pope wanted bishops to work only for the Church. In the end the Pope, with the support of the powerful Matilda of Canossa, excommunicated Heinrich IV, and in order to get back into the Church Heinrich was forced to do penance (say he was sorry) to the Pope, kneeling barefoot in the snow at Canossa in northern Italy in 1077 AD.
Near the end of Henry IV's life, his son Heinrich V (who was married to Matilda of England) rebelled against him, wanting to get along better with the Pope. Heinrich IV was forced to abdicate (give up being king) and let his son take over. In 1106, right after that, Heinrich IV died.
Although Heinrich V lost important battles to King Boleslaw of Poland in 1109, he soon gained strength. Heinrich V turned out to want to appoint bishops just as much as his father had. He began right away to appoint whatever bishops he wanted. Of course the Popes objected. In 1111 Heinrich V actually marched into Italy and took the Pope prisoner, and only let him go when the Pope promised to let Heinrich do whatever he wanted. In 1112 the Pope went back on his promise, and then in 1118 a new Pope excommunicated Heinrich V. Finally in 1122 they reached a compromise called the Concordat of Worms (there is a city in Germany called Worms). Heinrich V never had any sons, so when he died in 1125 the German nobles elected a new emperor, Lothair II, from a different family.
Lothair II carried on the Concordat of Worms, and campaigned in Italy like other German kings, in cooperation with the Byzantine Emperor John Comnenus. But Lothair II's position was stronger, because Poland was divided into many little kingdoms and couldn't fight him anymore. So Lothair III also fought wars to expand Germany and made Poland and Denmark agree to do whatever Germany said.
Conrad III was the grandson of Heinrich IV (through Heinrich's daughter Agnes) and became emperor after Lothair II's death in 1138. Conrad went on the Second Crusade, which was partly successful. But he was unable to get control of Italy, even though he kept trying. People divided into two groups. One was on Conrad's side, and thought it would be a good idea if the German Emperor ruled Italy. These were known as the Ghibellines (GIB-el-eens). The other group was on the Pope's side and wanted the Germans to leave Italy alone. They were known as the Guelfs (GELFS). The Guelfs had support from Roger II, the Norman king of Sicily, so they mostly won.
But in 1152, Conrad's nephew, Friedrich Barbarossa (Red-beard), became Holy Roman Emperor. Friedrich was a strong fighter who insisted on controlling northern Italy as well as Germany. This idea went well at first, but later on Friedrich got involved in civil wars in Germany with Heinrich Guelf, who had first been his friend. Everybody ended up choosing side, even the Italians. Still, Friedrich remained emperor a long time, and died an old man. He was drowned crossing a river on the Third Crusade in 1190 AD.
After Friedrich died, his son Heinrich VI took over as Holy Roman Emperor, and also got control of southern Italy, and a huge fortune he got from holding Richard the Lionhearted hostage. Henry was then the most powerful ruler in Europe, and he began to make plans to marry his relatives to Byzantine princesses like the Ottonians before him, hoping to unite East and West and rebuild the Roman Empire. When Heinrich died after only seven years (probably of malaria he caught in southern Italy), his son Friedrich II was elected Holy Roman Emperor.