It's sometimes fairly arbitrary which direction is the length and which is the width. But usually it's more natural to let the length be the longer direction.
It's also common to talk about "width and height" instead of "length and width." In this case, height is usually vertical, and width horizontal.