How can I place two headings next to each other using CSS?

后端 未结 3 1571
醉话见心
醉话见心 2021-01-17 14:34
Category
auto

places Category and auto on separate lines, like this:

3条回答
  •  自闭症患者
    2021-01-17 15:02

    h(n) elements are 'block' elements, which means they will grow to take all available horizontal space. This also means they will push anything "right" of them down to the next line.

    One easy way to accomplish this is to set their display to inline:

    
    

    Note that inline-block is not supported in all browsers.

    You can also float block elements, but that can become a sticky issue as floating can be fairly complex. Stick with inline for cases like this.

提交回复
热议问题