w3.css
doesnt currently support "input-group"s. I use the term input groups, because this is the term that Twitter Bootstrap uses to refer to what you're looking for. What we can do, is examine the Bootstrap input-group
code, and extend w3.css
's code to include similarly prefixed versions. Unfortunately, w3.css
uses the class w3-input-group
already, so we will use w3-inline-input-group
.
HTML
<div class="w3-row w3-section">
<div class="w3-col s7">
<label><b>Apple</b></label>
</div>
<div class="w3-col s5 w3-inline-input-group">
<i id="plus" class="fa fa-plus w3-input-group-addon"></i>
<input id="noOfApple" class="w3-input w3-border-0" type="text" name="noOfApple" value="1" size="3">
<i id="minus" class="fa fa-minus w3-input-group-addon"></i>
</div>
</div>
CSS
.w3-inline-input-group {
position: relative;
display: table;
border-collapse: separate;
}
.w3-inline-input-group .w3-input {
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0;
}
.w3-inline-input-group .w3-input:focus {
z-index: 3;
}
.w3-input-group-addon,
.w3-inline-input-group .w3-input {
display: table-cell;
}
.w3-input-group-addon
{
width: 1%;
white-space: nowrap;
vertical-align: middle;
}
.w3-input-group-addon {
font-size: 24px;
font-weight: normal;
line-height: 1;
text-align: center;
}
JSFIDDLE
NOTE: JsFiddle doesnt allow inclusion of non-https external files, so please scroll to the BOTTOM of the css pane to find the new/above css
PS. If you havent come too far in your project, and you're going to be working with form
elements a lot, I would strongly suggest looking into the Twitter Bootstrap CSS framework (you can customise an export of the library, to exclude all JS if you want to build all your own stuff, but again, they have a lot of very useful out-of-the-box code that I would recommend). It's a great place to start, and is far more widely used that w3.css (at least in terms of jobs asking for a knowledge of it)