Screen resolutions

To my understanding the terms 720p and 1080p when used in context of TV or screen resolutions mean the minimum number of pixels in terms of height that the screen needs to display to present high definition images.

So how come suddenly in 4K displays the number 4096 refers to the width?