S
S
svr52018-03-10 08:44:39
css
svr5, 2018-03-10 08:44:39

How to set the width of a flex element?

Please tell me, there is such a block, with the date and text. I'm laying it out with flexbox.
joxi.ru/Drl99JXC4LD1Pm

<div class="news">
      <div class="news__date">26 мая</div>
      <div class="news__text">
               <div class="news__link">Лучший магазин</div>
               <div class="news__paragraph">конкурс главой города...</div>
      </div>
</div>

.news {
display: flex
} The
question is: I put width: 50px; news__date and it doesn't take a width, it follows the content! And if I prescribe max-width: 50px; and min-width: 50px; then everything works!
Why is this happening? And how to set a fixed width for a flex element?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Glorious Cat, 2018-03-10
@svr5

https://jsfiddle.net/tansur/h4cwbb54/

D
Dmitry, 2018-03-10
@By_Engine

flex basis

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question