jerrythomas38
jerrythomas38

Reputation: 769

HTML CSS: Make Parent Flex equal Width of Children Automatically

How do I make a Flex Container Parent Container have its Width Equal to Total Width of Children? Right now my width of Parent is taking whole length of screen. For some reason width 100% is not working. I don't want to manually set the width and height of Parent, but have it automatically configure to whatever can contain child elements.

Upvotes: 0

Views: 872

Answers (1)

Ajay Varghese
Ajay Varghese

Reputation: 769

Try display: inline-flex for the parent instead of display: flex

.parent {
   display: inline-flex;
}

Upvotes: 1

Related Questions