-1

I have 2 divs and using flex:

.parent {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: red;
}

.item {
  height: 40px;
  margin-bottom: 10px;
}

<div class="parent">
  <div class="item">something here</div>
</div>

My issue is that the parent is 100% the width of the screen.

How can I make it so it stay's as large as the item content, so auto grows (when there's more text is grows or shrinks with less)?

Tomazbyden2000
  • 83
  • 3
  • 12

1 Answers1

1

Use inline-flex instead of flex:

display: inline-flex;
fahimchowdhury
  • 424
  • 4
  • 8