Align H1 Header and Normal Text in Same Line

前端 未结 6 2089
灰色年华
灰色年华 2021-02-06 23:33

I\'m trying to have a H1 header and regular text on the same line, with a line under it, like so:

\"enter

6条回答
  •  南方客
    南方客 (楼主)
    2021-02-07 00:03

    There are two methods to accomplish H1 and TEXT inline. To clarify, TXT is in an element container. You suggest DIV, but any symantic element will do. Below, h1 and p illustrate a common use, while showing that you need not hide from element blocking, using DIV's (though divs are pandemic for many javascript coders).

    Method 1

    .inline { display: inline; float: left; padding-right: 2rem; }
    
    Element a's link family...

    Method 2

    h5 { display: inline-block; float: left; font-size: 1rem; line-height: 1rem; margin-right: 2rem; }
    h5>p { display: inline-block; float: right; }
    
    Title

    Paragraph

提交回复
热议问题