-2

I can't seem to figure out how to get these divs to display on the same line. Any help would be greatly appreciated.

.pos-sts {
    display: inline-block;
    background-color: slategray;
    border: 1px solid black;
    text-align: center;
    width: 50%;
 }
<div class="pos-sts">
  <h3>Items in Position/Block</h3>
</div>
<div class="pos-sts">
  <h3>Items Trained During Eval Period</h3>
</div>
0stone0
  • 34,288
  • 4
  • 39
  • 64
Mmilest8
  • 15
  • 3

2 Answers2

-2

The <div>'s arn't next to each other because there's no room.

2x 50% is to much to be placed next to each other.

Consider changing the width to eg 49%

.pos-sts {
    display: inline-block;
    background-color: slategray;
    border: 1px solid black;
    text-align: center;
    width: 49%;
 }
<div class="pos-sts">
  <h3>Items in Position/Block</h3>
</div>
<div class="pos-sts">
  <h3>Items Trained During Eval Period</h3>
</div>

Or, use so you don't have to worry about the width:

.pos-sts {
    background-color: slategray;
    border: 1px solid black;
    text-align: center;
 }
 
.wrapper {
  display: flex;
  justify-content: space-between;
}
<div class="wrapper">
  <div class="pos-sts">
    <h3>Items in Position/Block</h3>
  </div>
  <div class="pos-sts">
    <h3>Items Trained During Eval Period</h3>
  </div>
 </div>
0stone0
  • 34,288
  • 4
  • 39
  • 64
-2

I used display:inline; and float:left and it worked just how I needed it to!

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Mmilest8
  • 15
  • 3
  • The other answer doesn't suggest `float:left`. Accepting it instead of posting what works seems... counterintuitive here. – Wai Ha Lee Jun 01 '21 at 08:24