Removing newline after

tags?

前端 未结 4 468
死守一世寂寞
死守一世寂寞 2021-01-30 19:00

I am having a problem with removing linebreaks after the

tag, as everytime it prints, it adds a line break straight after it, so something like <

4条回答
  •  鱼传尺愫
    2021-01-30 19:50

    Sounds like you want to format them as inline. By default, h1 and h2 are block-level elements which span the entire width of the line. You can change them to inline with css like this:

    h1, h2 {
        display: inline;
    }
    

    Here's an article that explains the difference between block and inline in more detail: http://www.webdesignfromscratch.com/html-css/css-block-and-inline/

    To maintain vertical padding, use inline-block, like this:

    h1, h2 {
        display: inline-block;
    }
    

提交回复
热议问题