I just want to get the maxHeight of an element previously define at css but doesnt work. It only works if I modify it explicitly with javascript first
let something=document.querySelector(".something");
let before=document.querySelector(".before");
let after=document.querySelector(".after");
before.textContent=something.style.maxHeight
something.style.maxHeight="20px";
after.textContent=something.style.maxHeight;
.before::before{
content:'Before:'
}
.after::before{
content:'After: '
}
.something{max-height:30px}
<body>
<div class="something">
Something very cool
</div>
<div class="before">
Before:
</div>
<div class="after">
After:
</div>
</body>