Vinothkumar Nataraj
Vinothkumar Nataraj

Reputation: 588

Two <p> tag set in one line?

    <p style="display:inline"> First Name<p id="name"> Ram. </p> <p>

Output: First Name Ram. How to get this answer?

Upvotes: 1

Views: 21798

Answers (3)

Felipe Pincheira
Felipe Pincheira

Reputation: 474

The < p > tag defines a paragraph. you need add a < span > tag

<p><span>First Name</span><span id="name"> Ram.</span></p>

you can see work here http://codepen.io/felo89/pen/MKweJd?editors=100

Upvotes: 6

Rounin
Rounin

Reputation: 29463

You can use display:inline-block; to enable block-level elements to sit adjacent to one another:

p {
display: inline-block;
}
<p>First Name</p>
<p id="name">Ram.</p>

Upvotes: 3

Muhammet
Muhammet

Reputation: 3308

Add .inline class to both paragraphs. Consider using span instead.

.inline {
  display: inline;
}
<p class="inline">First Name</p>
<p class="inline" id="name">Ram.</p>
<p>

Upvotes: 11

Related Questions