http://revach.net/article.php?id=1638

Section: Halacha   Category: Tshuvos
Shevet HaKehosi: Piling Up Seforim
Kedushas Seforim prohibits you from putting other seforim on top of a Chumash.  What about putting rishonim or acharonim on a gemara?  The Shevet HaKehosi (2:301) says that it could be permissible.  The only time we are Makpid is by Sifrei Tanach where there is big discrepancy in the Kedusha.  However just because one sefer is considered more Kadosh than another it doesn't mean that you must pile them in order of Kedusha.  He proves this from the fact that if you have a Sefer from Nevi'im and a Sefer from Kesuvim there is not halachic requirement to put the Nevi'im on top even though Nevi'im are more Kadosh than Kesuvim.

Disclaimer: We try to convey the Tshuva to the best of our ability. We admit that our understanding may not be accurate. Please also understand that this Tshuva may not be the final word on this topic. One should consult a Rav before drawing any conclusions.