Is there any guide on “When to use display:block when :inline and when :inline-block” and why?

前端 未结 4 1143
甜味超标
甜味超标 2020-12-23 15:40

Do you know any good article on \"When to use display:block when :inline and when :inline-block\" and why?

and when we will ha

4条回答
  •  醉话见心
    2020-12-23 16:06

    inline - Treats the element as though it were an inline chunk of text. width and height are meaningless

    block - Treats the element as as rectangle. width and height can be specified

    inline-block - Flows a element inline with the text, but allows width and height to be specified.

    Elements default to one of these anyway. For example:

    , , -> inline

    ,

    -> block

提交回复
热议问题