Answer the question
In order to leave comments, you need to log in
How to make an element the same width as the content in flexbox?
There is a menu on flex:
<ul>
<li>Itemitemitemitemitem itemitemitemitemitem 1</li>
<li>Itemitem 2</li>
<li>Itemitem 3</li>
<li>Itemitem 4</li>
<li>Itemitem 5</li>
</ul>
ul {
display: flex;
margin: 0;
padding: 0;
list-style: none;
}
li {
float: left;
margin: 2px;
padding: 5px 10px;
background: #E1E1E1;
}
Answer the question
In order to leave comments, you need to log in
if i understand correctly,
li:first-child{
white-space: nowrap;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question