1

Say I have this code:

<div style="width:100%" id="a"></div>
<div id="b"></div>

I want the #b's height to equal #a's width and always following that value.

What I can do is to use JS to get #a's width and set it to #b's height.

However, is there any pure CSS way to do so, something like this:

#b {
  height:getvalue('#a', 'width');
}
AGamePlayer
  • 6,582
  • 17
  • 52
  • 105
  • Not in pure css unless using any css pre-processor.Try setting both values in css. It should solve your problem. – Sangam Belose Jan 11 '21 at 05:54
  • Does this answer your question [How do I select an element based on the state of another element in the page with CSS?](https://stackoverflow.com/questions/28708741/how-do-i-select-an-element-based-on-the-state-of-another-element-in-the-page-wit) – Tanner Dolby Jan 11 '21 at 05:55

0 Answers0