I want to create a page to test responsive layout of a page in my application, however media queries only work with window resolution, is there any way to apply CSS while changing the width of parent element.
For example:
<html>
<head>
<style>
.child-element{font-size: 30px};
@media screen and (max-width:768px) {
.child-element{font-size: 24px}
}
</style>
</head>
<body>
<div class="parent-element">
<div class="child-element">Heading 1</div>
</div>
</body>
</html>
Now I want to child-element style based on the width of parent-element, if the parent-element width is less than or equal to 768px then similar style I have written in media query should apply.