0

<div class="input1" style="display:flex">
  <div class="form-group shiny-input-container">
    <label class="control-label" id="t" for="totalMV">Total:</label>
    <input id="totalMV" type="number" class="form-control" value="0"/>
  </div>
  <div class="form-group shiny-input-container">
    <label class="control-label" id="decim" for="decimal">Dec</label>
    <input class="js-range-slider" id="decimal" data-skin="shiny" data-min="0" data-max="1" data-from="0.5" data-step="0.1" data-grid="true" data-grid-num="10" data-grid-snap="false" data-prettify-separator="," data-prettify-enabled="true" data-keyboard="true" data-data-type="number"/>
  </div>
</div>

Is there a way to add a gap between elements inside div. Right now there is no space/gap between these 2 elements. But can we add?

Coskun Ozogul
  • 2,389
  • 1
  • 20
  • 32
manu p
  • 952
  • 4
  • 10

3 Answers3

2

since you are already using flex, why not utilize its useful gap system like this:

.input1 {
  gap: 12em;
}

.input1 {
  gap: 12em;
}
<div class="input1" style="display:flex">
  <div class="form-group shiny-input-container">
    <label class="control-label" id="t" for="totalMV">Total:</label>
    <input id="totalMV" type="number" class="form-control" value="0" />
  </div>
  <div class="form-group shiny-input-container">
    <label class="control-label" id="decim" for="decimal">Dec</label>
    <input class="js-range-slider" id="decimal" data-skin="shiny" data-min="0" data-max="1" data-from="0.5" data-step="0.1" data-grid="true" data-grid-num="10" data-grid-snap="false" data-prettify-separator="," data-prettify-enabled="true" data-keyboard="true"
      data-data-type="number" />
  </div>
</div>
Ahmad
  • 12,336
  • 6
  • 48
  • 88
0

You can use the column-gap attribute on the outer div:

div.input1 {
    display: flex;
    column-gap: 1em;
}
PiFanatic
  • 233
  • 1
  • 4
  • 14
0

You can use padding who will align elements inside div or you can use margin to align your div.

.shiny-input-container{
padding-left:20px;
}
<div class="input1" style="display:flex">
  <div class="form-group shiny-input-container">
    <label class="control-label" id="t" for="totalMV">Total:</label>
    <input id="totalMV" type="number" class="form-control" value="0"/>
  </div>
  <div class="form-group shiny-input-container">
    <label class="control-label" id="decim" for="decimal">Dec</label>
    <input class="js-range-slider" id="decimal" data-skin="shiny" data-min="0" data-max="1" data-from="0.5" data-step="0.1" data-grid="true" data-grid-num="10" data-grid-snap="false" data-prettify-separator="," data-prettify-enabled="true" data-keyboard="true" data-data-type="number"/>
  </div>
</div>

<div class="input1" style="display:flex">
  <div class="form-group shiny-input-container">
    <label class="control-label" id="t" for="totalMV">Total:</label>
    <input id="totalMV" type="number" class="form-control" value="0"/>
  </div>
  <div class="form-group shiny-input-container">
    <label class="control-label" id="decim" for="decimal">Dec</label>
    <input class="js-range-slider" id="decimal" data-skin="shiny" data-min="0" data-max="1" data-from="0.5" data-step="0.1" data-grid="true" data-grid-num="10" data-grid-snap="false" data-prettify-separator="," data-prettify-enabled="true" data-keyboard="true" data-data-type="number"/>
  </div>
</div>
Coskun Ozogul
  • 2,389
  • 1
  • 20
  • 32