Hydraulic fractures are used to enhance the hydrocarbon production from low permeability rocks and to measure the minimum in-situ principal stress in rock formations. In these cases, the fracture growth above (or below) the formation of interest is a key metric for the design of a successful hydraulic fracture application. The variation of confining stress between rock layers can limit the vertical hydraulic fracture growth and represents one of the main reasons for the fracture containment at depth. On the other hand, a contrast of fracture toughness can also lead to fracture containment. Fracture toughness contrasts can be found at large scale due to lithological changes, but they are also present at smaller scales, down to the size of bedding planes. By combining scaling arguments and 3D planar hydraulic fracture simulations, we demonstrate that the interaction of a hydraulic fracture with a repetitive sequence of multiple layers of different fracture toughness can ultimately lead to the emergence of an elongated fracture or, alternatively, to the propagation of an elliptical-like fracture with a fixed aspect ratio.