how to avoid a new line with p tag?

后端 未结 5 594
灰色年华
灰色年华 2020-12-13 02:07

How can I stay on the same line while working with

tag?

相关标签:
5条回答
  • 2020-12-13 02:18

    The <p> paragraph tag is meant for specifying paragraphs of text. If you don't want the text to start on a new line, I would suggest you're using the <p> tag incorrectly. Perhaps the <span> tag more closely fits what you want to achieve...?

    0 讨论(0)
  • 2020-12-13 02:24

    something like:

    p
    {
        display:inline;
    }
    

    in your stylesheet would do it for all p tags.

    0 讨论(0)
  • 2020-12-13 02:29

    Flexbox works.

    .box{
      display: flex;
      flex-flow: row nowrap;
      justify-content: center;
      align-content: center;
      align-items:center;
      border:1px solid #e3f2fd;
    }
    .item{
      flex: 1 1 auto;
      border:1px solid #ffebee;
    }
    <div class="box">
      <p class="item">A</p>
      <p class="item">B</p>
      <p class="item">C</p>
    </div>

    0 讨论(0)
  • 2020-12-13 02:31

    I came across this for css

    span, p{overflow:hidden; white-space: nowrap;}
    

    via similar stackoverflow question

    0 讨论(0)
  • 2020-12-13 02:37

    Use the display: inline CSS property.

    Ideal: In the stylesheet:

    #container p { display: inline }
    

    Bad/Extreme situation: Inline:

    <p style="display:inline">...</p>
    
    0 讨论(0)
提交回复
热议问题