Before the creation of the Shulchan Aruch each community Rav would issue Halachic rulings based on his personal calculations. There were Rabanim that paskened like the Rif and there were others that would go according to the Rosh or the Rambam. Often what one Rav permitted, was prohibited by another Rav. This caused a lot of confusion and controversy in many communities. This was especially true when members of one community would relocate to an established community. There was no set and established Halachic order until the publication of the Shulchan Aruch.
In the Shulchan Aruch Rabbi Yosef Caro delved into the root of each Halacha and how the Rishonim dealt with it. He then issued the Halachic ruling based on the opinion of the majority of the Rishonim. Generally Halachic rulings were established according to the opinions of the Rambam, Rif and the Rosh, going after the majority of the three, with some exceptions when it came to the Rambam. Sometimes the opinions of the Ramban, Rashba and Ran were taken into consideration.
The Shulchan Aruch is composed of four parts and is based on the previous structure of the Tur. Almost all base Halachic elements of current Jewish life are discussed in the Shulchan Aruch. Also included were some recent Minhagim and rulings that appeared over the generations. Initially created as a summery of the Beit Yosef, the Shulchan Aruch does not list the sources of each Halacha only the final rulings.
The Shulchan Aruch is composed of four sections each dealing with a separate area of Jewish life.
- Arach Chaim - Laws between man and Hashem.
- Yoreh Deah - Laws of things that are permitted and prohibited.
- Even Haezer - Laws between a man and his wife.
- Choshen Mishpat - Laws between people.
When the Shulchan Aruch first came out it was met with opposition from a lot of leading rabbis including the Maharam, the Mharshal, the Baal Halivushim and Rabbi Eliezer Ashkanazi. Since the Shulchan Aruch greatly simplified the process needed to research Halacha, many rabbis were afraid it would lead to a great laxity amongst Torah scholars who would no longer need to analyze the actual sources in the Talmud and Rishonim. This was also one of the arguments against the Rambam when he published the Yad Hachazaka. One of the main opponents to Rabbi Caro's works was Rebbe Yosef ibn Lev. Once after failing to recall a halachic source in his daily Tur Shiur, Rebbe Yosef ibn Lev took this as a divine sign to withdraw his opposition and instructed his students to start using the Beit Yosef and Shulchan Aruch.
 The Rama
Aside from the above opposition, many Ashkanazi rabbis were opposed to Rabbi Yosef Karo's work since he ignored almost all Rishonim from Germany and France, choosing to rule like the Sephardic opinions. This opposition was led mainly by the 'Rama' - Rabbi Moshe Isserles who eventually created an appendix to be inserted into the Shulchan Aruch, section by section with all the Ashkanazi rulings. Originally this appendix called the 'Mapah' was published as a separate book but after a few years it started being printed inline with the Shulchan Aruch. The actual text of the Shulchan Aruch is printed in bolder Hebrew letters while the 'Mapah' from the Rama is printed at the end of each applicable Sif often prefixed with the word 'Hagah' -- literally 'an edit'.
 Official Code of Jewish Law
Eventually all opposition against the Shulcahn Aruch faded and it was accepted by Jewish communities worldwide as the official Code of Jewish Law. Rabbi Yosef Karo is accepted as the official Halachic authority by a most Sepharadim other then the followers of the Kabbalistic oriented version of Halacha from the Ben Ish Chi based on the teachings of the Ari. In instances when the Rama does not argue, the opinion of Rabbi Yosef Caro is generally accepted by the Ashkanazim as well. Over time many commentaries were written on the Shulchan Aruch, the more important ones being printed as part of the actual text. These include the Shach, Magen Avraham, Turei Zahav and Ber Hagola. Initially Rabbi Yosef Karo created the Shulchan Aruch with the intention of making it reviewable by students each month. With the addition of all the commentaries this became impossible. It is from his work on the Shulchan Aruch that Rabbi Yosef Karo gained the title Ha-Mechaber, literately 'the Author'.
The Chida brings down a tradition that in that generation there were three Rabbis whose name was Yosef, all whom were worthy of creating an official 'Code of Jewish Law'. These were the Rabbi Yosef ben Lev, Rabbi Yosef Taitazak and Rabbi Yosef Caro. In the end the latter was chosen in heaven for the task due to his humility which exceeded the other two.
 Abridged Version
In following generations a number of attempts were made to compress the Shulchan Aruch and adjust rulings according to current local customs. These include the Kitzur Shulchan Aruch, Shulchan Aruch Harav and the Chayei Adam.
 Shulchan Aruch in Breslev
Rabbi Nachman of Breslov warned his followers to be very careful about following the Shulchan Aruch and not to deviate from even one law. At the same time he opposed being into extra stringencies and if there were valid lenient opinions one could follow them. Rabbi Nachman said that it is crucial for every person to learn at least one Halacha in Shulchan Aruch everyday. This is followed by many Breslov Chasidim, some who even keep an pocket sized copy in their Talis bags.