How to make <p> and <span> the same line height in HTML 5?

How to make pand spanthe same line height in HTML 5?

.main-body-text {
  color: #666;
  font-size: 10px;
  font-family: robotolight, sans-serif;
  text-align: left;
  line-height: 14px;
}

Js fiddle

+4
source share
1 answer

The problem is that pthey spanhave different types display, which leads to different behaviors due to hidden spaces between the lines.

If you want both of them to be the same line-height, force them to have the same type:

display:inline; // or 'block' or 'inline-block'

Jsfiddle demo

+4
source

All Articles