1

I feel like this should be easy, but I'm trying to get my .temp and .city divs to be side-by-side, but they're stacking vertically instead.

I've tried changing the size of the columns, but they always stack on top of each other. Any ideas?

          <div class="col-lg" id="col2">
            <div class="row">
              <div class="col-lg">
                <div class="wind"></div>
              </div>
            </div>
            <div class="row">
              <div class="col-lg" id="col3">
                <div class="temp"></div>
                <div class="city"></div>
              </div>
            </div>
          </div>
Nick Tamburro
  • 150
  • 1
  • 4
  • 16

3 Answers3

2

You can wrap temp div and city div into 2 different columns. Check this Bootstrap4 Example.

.wind,
.temp,
.city {
  height: 50px;
  border: 1px solid red;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet" />


<div class="col-sm" id="col2">
  <div class="row">
    <div class="col-lg">
      <div class="wind"></div>
    </div>
  </div>
  <div class="row">
    <div class="col-lg" id="col3">
      <div class="temp"></div>
    </div>
    <div class="col-lg" id="col3">
      <div class="city"></div>
    </div>
  </div>
brian17han
  • 1,239
  • 1
  • 8
  • 15
2

You can rearrange your html code to this format.

        <div class="row">    
            <div class="col-lg" id="col2">
                <div class="col-lg">
                    <div class="wind"></div>
                </div>
            </div>            
            <div class="col-lg" id="col3">
                <div class="temp"></div>
                <div class="city"></div>
            </div>
        </div>
Serj Sagan
  • 28,927
  • 17
  • 154
  • 183
emekamba
  • 188
  • 9
1

You should edit your code to this, making the second row have two columns.

<div class="col-lg" id="col2">
        <div class="row">
          <div class="col-lg">
            <div class="wind"></div>
          </div>
        </div>
        <div class="row">
            <div class="col temp"></div>
            <div class="col city"></div>
        </div>
      </div>
esther kay
  • 161
  • 7