The layout adapts to the width of the parent?

The problem is the following: there is an adaptive element, placed in a certain div. If you change the width of this diva, the elements do not adapt and everything looks crooked. If after following the instructions to scale the window, everything adjusts fine.

I believe this is due to the fact that @media not looking at the width of the parent, and the width of the screen. Is there any way to bind the media queries directly to the width of a diva?
Preferably without using afremov
March 25th 20 at 12:40
2 answers
March 25th 20 at 12:42
Media queries in css based on the screen parameters (width, height, orientation, etc.), so using them cannot refer to the width of the div. To monitor the size of the element on the page will have to use js.
March 25th 20 at 12:44
as mentioned above you need js or why that element which depends on the parent not to do in %? to change the size of parent as a percentage change and the indoor unit. Though it is not clear what the task is and what you want to zoom in and zoom out)) It would be good to understand what is in that child who does not adapt to the parent)
Yes, take for example budapeszcie card (

I have added to each card in div.demo. There are also 3 buttons - phone, PC, tablet. When you click on a particular button width diva.demo changing.
This is to demonstrate to the user the adaptability of the cards clearly - Drew94 commented on March 25th 20 at 12:47
I understand that js can solve the problem, but I don't know what exactly to Google. If you tell me I should be grateful - Drew94 commented on March 25th 20 at 12:50
@Drew94, have you tried the decency to at least throw a code ? - Kenny_Kuhlman commented on March 25th 20 at 12:53
@Kenny_Kuhlman, code what do you throw?
The elements are these:
Each element is wrapped in a div with class demo
There are 3 buttons that change the width of the diva demo

What kind of code is it? - Drew94 commented on March 25th 20 at 12:56

Find more questions by tags Adaptive designHTMLCSS