How to prevent headings (

) from taking up more width than they need?

后端 未结 4 920
长发绾君心
长发绾君心 2020-12-29 20:30

If I define a heading like

, its width is set to 100% by default.

Is there a way to make sure its width is set to the smallest value possible

4条回答
  •  被撕碎了的回忆
    2020-12-29 21:11

    Instead of display: inline, give it display: inline-block. This will retain the block-like qualities of the h1 tag, except for the 100% width.

提交回复
热议问题