I want to be able to add an "!important" to the height of #content on line 7 of the code below. I need to be able to use the variable $newHeight because it needs to stay dynamic.
Does anyone know how I can append an !important to this css declaration? I tried using a plus (+) sign to concatenate, but was unsuccessful.
Here is the code:
$(window).resize(function() {
var $windowHeight = $(window).height();
var $newHeight = $(window).height()-$('#footer').height()-153;
if ($windowHeight < 847){
$('#content').css("height",$newHeight);
}
});
position: fixed;on it and not adjusting the content height. Just my two cents.!importanthere for the inline style? Is this value set as!importantin a stylesheet somewhere?$(window).scroll(function(){ $('#footer').css('left',-$(window).scrollLeft()); });but I don't know if that's really better or not. (I'd say it is, as losing a footer if the JavaScript is disabled is less major than losing content.)!importantin website stylesheets is usually a bad practice - the attribute is meant to be used in places like user-specific stylesheets to override styling provided by the page. Instead you should figure out why the style isn't being applied without that attribute. (And if you're setting it on the element inline, it should have the highest specificity - it might be that something else is making it impossible for the element to have that height.)