A
A
aweui2018-07-04 10:55:25
css
aweui, 2018-07-04 10:55:25

How to make child img's dynamic width equal to the parent block with flex?

Good afternoon!
The problem is in the title of the question.
The .b-block property is set to display: flex. When changing the width of the screen, it is necessary that the child img inside always be equal to the width of the parent - .b-block
Can this be done using css?
Link to Codepen

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2018-07-04
@aweui

.b-main .b-block__item {
    list-style: none;
    width: 100%;
    flex-shrink: 0;
}

S
SagePtr, 2018-07-04
@SagePtr

img {
  width: 100%;
}
doesn't fit?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question