Is it possible to set two values for one attribute in a CSS identifier, for example.
height: 12m; height: 12 in the morning;
for one id? I know that this can be done using CSS, but I want to change the height using javascript and have both values for the same attribute, so that "em" functions as a reserve for browsers that do not support "rem".
Example:
function updateHeight() {
var testElem = document.getElementById("testId");
testElem.style.height = "12em";
testElem.style.height = "12rem";
}
#testId {
height: 8em;
height: 8rem;
background-color: black;
color: white;
}
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<meta charset="utf-8" />
</head>
<body>
<div id="testId">
BlaBla
</div>
<button onclick="updateHeight()">Bla</button>
</body>
</html>
Run codeHide result
source
share