Why some elements don't have height and width?



Why do we need to set height and width, and why some elements don’t have it?


It is not always necessary to set a height and width. Elements by default are block elements and will have the same width as the container, and their height will vary depending on their content. The element’s measurements will be decided by what purpose we want it to have, just like news paper’s editors will arrange the columns, sometimes we will want to have an image that will only cover half of the screen, or even less. That is when we could use height and/or width measurements.