What is the value of the css 'ex' unit?

后端 未结 5 879
时光说笑
时光说笑 2020-11-28 03:21

(Not to be confused with Xunit, a popular .Net unit testing library.)

Today in a fit of boredom I started inspecting Gmails DOM (yes, I was very bored).

Ever

5条回答
  •  醉梦人生
    2020-11-28 04:01

    It is useful when you want to size something in relation to the height of your text's lowercase letters. For example, imagine working on a design like so:

    alt text


    In the typographic dimension of design, the height of letters has important spatial relationships to the rest of the elements. The lines in the source image above are intended to help point out the x-height of the text, but they also show where guidelines would be if designing around that text.

    As Jonathan pointed out in the comments, ex is simply the height version of em (width).

提交回复
热议问题