Home > database >  Display multiple lines (<p> tags) as a paragraph
Display multiple lines (<p> tags) as a paragraph

Time:12-10

I want to display multiple lines for example:

  1. This is first sentence.
  2. This is second sentence.
  3. This is third sentence.

These three sentences need to displayed as -

This is first sentence. This is second
sentence. This is third sentence

Sample html for this could be

<p id="line-1"></p>
<p id="line-2"></p>
<p id="line-3"></p>

The use case is I need to track and save changes done in each sentence and save them seperately.

Any help appreciated.

CodePudding user response:

You can try this

<body>
    <p>
        <span>This is first sentence. This is second
        sentence. This is third sentence</span>
    </p>
</body>

CodePudding user response:

Attach style display: 'inline-block' | 'inline'

<p id="line-1" style="display: inline"></p>
<p id="line-2" style="display: inline"></p>
<p id="line-3" style="display: inline"></p>

CodePudding user response:

You can use </br> to split the statements in different lines.

<body>
    <p id="line-1">1. This is first sentence.</br></p>
    <p id="line-2">2. This is second sentence.</br></p>
    <p id="line-3">3. This is third sentence.</p>
</body>

CodePudding user response:

The sentence could be given inside a span as it is an inline container used to mark up a part of a text, or a part of a document.

<div>
    <p>
        <span>This is first sentence. This is second
        sentence. This is third sentence</span>
    </p>
<div>

  • Related