Reputation: 588
<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
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
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
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