Final answer:
The codex replaced the scroll in the fourth century because it was more durable and easier to navigate. The invention of the printing press later contributed to its popularity.
Step-by-step explanation:
The codex replaced the scroll in the fourth century for several reasons. Firstly, the codex was more durable than the scroll, as the paint on scrolls would flake off when unrolled. Secondly, the codex was easier to navigate and find specific passages in, as readers could quickly flip through the pages. Lastly, the invention of the Gutenberg printing press in the fifteenth century made it possible to produce books more rapidly, further popularizing the use of the codex.