Reputation: 345
Within a HTML table cell, I have a text input element, followed by some standard text. I want both items to be inline.
This works fine until I import bootstrap.css, at which point the items are shown on separate lines, as if a line break exists between them.
I am unsure on how to "override" whatever styling bootstrap is applying.
Please see my JS Fiddle below. I have included the bootstrap.min.css resource.
You can see that the text input field and string "m" are on separate lines within each cell.
Once you remove the Bootstrap.css external resource, and press run again, the items are inline.
How can I override whatever styling the Bootstrap CSS is applying? (I need Bootstrap CSS for other things).
Thanks
https://jsfiddle.net/87tdupys/9/
<!--Desired: text input field plus text "m" inline. However, Bootstrap.min.css is causing the 2 items to display on separate lines. This can be shown by removing the external reference to bootstrap.min.css (in the left hand External Resources pane). How can I override this behaviour, and force the 2 items to be inline?-->
<table id='assetConfigLayoutTable' border='1px'>
<tr>
<td>
<label>Capacity A</label>
</td>
<td style="width:200px">
<input type="text" class="form-control" style="width:50px;"> m
</td>
<td>
<label>Capacity B</label>
</td>
<td style="width:200px">
<input type="text" class="form-control" style="width:50px"> m
</td>
</tr>
</table>
Upvotes: 2
Views: 429
Reputation: 222
just take a new class name beside the form-control and put the below code in
your css
<style>
.text-display
{
display: inline-block !important;
}
</style>
<table id='assetConfigLayoutTable' border='1px'>
<tr>
<td>
<label>Capacity A</label>
</td>
<td style="width:200px">
<input type="text" class="form-control text-display"
style="width:50px;"> m
</td>
<td>
<label>Capacity B</label>
</td>
<td style="width:200px">
<input type="text" class="form-control text-display" style="width:50px">
m
</td>
</tr>
</table>
Upvotes: 1
Reputation: 13558
In twitter-bootstrap
by default .form-control
is block level element, you need to make it inline-block
element.
.form-control{
display:inline-block;
}
Upvotes: 3
Reputation: 1572
Or put a div with class form-inline
in the td
https://jsfiddle.net/87tdupys/7/
Upvotes: 1
Reputation:
just place a important !important
in your custom css ,
Hope it works for you
and there was no fiddle link.....
Upvotes: 0