Reputation: 13
<p>Name:</p><input type="text" style="display: inline" >
The input tag is going in the next line.I want it to be in the same line.I used the css styling property too but it isn't helping.
Upvotes: 1
Views: 38
Reputation: 182
As @David explained the <p>
tag is a block element. That means in won't align inline on default.
To solve your problem change your markup to:
<p>Name: <input [...] /></p>
But for what you are trying to do there is the label-tag.
<label for="name">Name: </label><input type="text" name="name" />
Upvotes: 0
Reputation: 218930
Because the p
element is a block element. If you want anything to be inline with it, then it too would need to be inline:
<p style="display:inline">Name:</p><input type="text" />
Upvotes: 1