Css difference in height and a line-height

As a front-end white, there are many simple things do not really understand, be sure to find out about after recording, for future reference, well, the beginning of the text

height

Property sets the height of the element.

Explanation

This attribute defines the height of the element's content area, outside of the content area can be increased padding, borders and margins.

This is the definition given w3c height is set a block element is set inline elements is invalid

 Is the height of the container, as long as the height of the element does not exceed the height of the container, height will not change

line-height

Setting the distance between the line (line H).

Note: negative values ​​are not allowed.

Explanation

The property will affect the layout of the line box. When applied to a block-level element which defines the minimum distance between the base element instead of the maximum distance. Equivalent to our own set how long the book

line-height and font-size difference between the calculated values ​​(a "line pitch" in CSS) is divided into two halves, it is applied to the top and bottom line of text content. The smallest box can contain them is the line box.

Height line-height is the height of a line of text, the book is equivalent to setting us how high a row

Welcome to correct me watch

 

 

 

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/lmd666/article/details/94654831