mhk
mhk
KPCKevin Powell - Community
Created by mhk on 7/20/2024 in #front-end
Is it possible to change styling of parent when hovered over child element in CSS?
The only way I know is using JS, in which I listen for hover on child element and change the parent styling in the function ( or by adding classnames), but is it possible by just using CSS selectors I want something like this: body { display: grid; grid-template-columns: 1fr 1fr; color: white; } body .left-part:hover { grid-template-columns: 3fr 1fr; } body.right-part:hover { grid-template-columns: 1fr 3fr; } in which body grid layout changes depending upon in which part I am?
3 replies