What is the definition of “the baseline of parent box”?

前端 未结 4 1438
星月不相逢
星月不相逢 2021-02-19 05:05

I have trouble understanding the following excerpt from 10 Visual formatting model details – W3C.

The excerpt:

baseline: Align

4条回答
  •  情书的邮戳
    2021-02-19 06:04

    Neither did I find a specific definition,and according to the specification:

    The following values only have meaning with respect to a parent inline element, or to the strut of a parent block container element

    You can infer that ,if there is a text node as child in the parent box ,the baseline of the child text node is the baseline of the parent box.

    For example:

    .parent {
      display: inline;
      background:pink;
      font-size:40px;
      font-family:Microsoft Yahei;
      line-height:2;
      vertical-align:baseline;
    }
    .element-child {
      font-size:25px;
    }
    textNode child of parent element-child with another font-size

    Whatever with or without child text node,the baseline of parent box is in the same position which is equal to the baseline of the child text node.

提交回复
热议问题