Reputation:
I am trying to add space before an input tag, and I noticed that Chrome didn't render the whitespace. What can I do to add a space. My code is very straightforward:
Q: <input type="text" id="q">
notice the space between Q: and the tag. I will use JS if I absolutely have to, but pure HTML is much better.
Upvotes: 1
Views: 4078
Reputation: 6656
Here is the two example of having a whitespace before your input tag. It's either using  
or css
. Using css is more neat for me in which you can easily change it's styles. Example below css with one character space.
#q1 {
margin-left: .5em;
}
<label for="q">Q:</label> <!-- using a space -->
<input type="text" name="q" id="q">
<br />
<label for="q1">Q:</label><!-- using css -->
<input type="text" name="q1" id="q1">
Upvotes: 0
Reputation: 573
If you would like a regular line whitespacing you can use <br>
but if you mean the literal whitespace before the the input box, you can use a margin
tag to give it more space.
E.g.
#q{
margin-left:10px;
}
Upvotes: 0