The CSS overflow property controls how content is displayed if it does not fit in its box. It can take values of scroll or auto. Scroll will always display scrollbars whether content overflows or not. Auto will only display scrollbars if content overflows. The example code shows div elements with the scroll and auto values to demonstrate how overflow is handled.