Or Smith
Or Smith

Reputation: 3616

HTML & Bootstrap/ Input with small width

I'm trying to create a small input in my HTML file.

Here is the relevant code:

<input type="number" id="inputNum" class="input-group" placeholder="number" value="1"> <br />

which using bootstrap library.

The problem is that my input is quite wide. I want my input to have a width of ~10% (just one number would be accepted in this field, and I need it small).

How can I achieve this?

Upvotes: 1

Views: 644

Answers (2)

Jon Mateo
Jon Mateo

Reputation: 384

<div class="col-md-1">

<input type="number" id="inputNum" class="input-group" placeholder="number" value="1"> </br>

</div>

Upvotes: 0

Diego Cardenas
Diego Cardenas

Reputation: 393

you need first to make an container or row for example:

<div class="row">
     <div class='col-sm-5'>
        <input type="text" class='form-control ' ></input>
     </div>
</div>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>

<div class="container">
	    <div class="row">
	        <div class='col-sm-3'>
	            <input type="text" class='form-control '>
	        </div>
		</div>
</div>

view the example in FullScreen!

Upvotes: 3

Related Questions