I have two input fields which I would like to be rendered on the same line. For the moment, they look like this:
I looked at other questions such as this one:
How to align two elements on the same line without changing HTML.
Therefore, I tried using {display:'inline-block'}
and 'margin-right:10px'
in my code.
However, the elements still do not appear in the same line.
My full code:
<div style={{display:'inline-block'}}>
<div className="form-group" style={{display:'margin-right:10px'}}>
<label>Category</label>
<br/>
<select className="form-control" value={this.state.selectCategoryValue} onChange={this.handleSelectCat}>
<option value="defaultCategory" disabled selected></option>
{categoryDesc}
</select>
</div>
{this.state.categorySelected
?
<div className="form-group" style={{display:'inline-block'}}>
<label>Classification</label>
<br/>
<select className="form-control" value={this.state.selectClassificationValue} onChange={this.handleSelectClass}>
<option value="defaultClassification" disabled selected></option>
{this.state.classificationDesc}
</select>
</div>
:
null
}
</div>
How can I put the components on the same line?