I have div.innerDivone that has been assigned height: 300px !important;in the CSS file. I can neither modify the existing CSS file nor add a new class to override. Since the style !important, so you can override it as a style inline, only !important. But this does not give the desired effect.
Submit a demo here .
UPDATE: I needed only the inline style.
HTML:
<div>
<div class="innerDiv">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing
software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>
CSS
.innerDiv {
height: 300px !important;
width: 150px;
border: 1px solid;
}
JS:
function overrideHeight() {
document.getElementsByClassName('innerDiv')[0].style.height = 400 + 'px !important';
}
overrideHeight();
source
share