The sea level is considered as zero altitude.

When we are near the sea (the beach) we are at level zero.

As we move away from the sea level the altitude rises. Therefore when we say that a mountain has a height of 500 meters (or feet) means that if we bring the vertical line from the sea level to reach the same height as the top of the mountain, this line would be 500 meters (or feet) long.

Suppose we have a helicopter that rises vertically from the sand dropping a robe As soon as the pilot sees straight in front of him (horizontal) the top of the mountain he measures the length of the drop. The length of the rope (distance helicopter and sea) is the height of the mountain.

The height of a mountain can not be measured using a car, because the car does not rise vertically and therefore it travels a much longer distance (many turns) to reach the top of the mountain.