5

Is it possible, to specific CSS styles by some DIV width or height?

Something like this:

@media screen and (max-width: 1024px) 
TylerH
  • 20,799
  • 66
  • 75
  • 101
general666
  • 1,001
  • 2
  • 16
  • 31

1 Answers1

3

You can do this with jQuery.

function change_size(){
   var window_height = $(window).height();
   var div_height = $("#your_id").height();
   if(window_height < div_height){
          $("#your_id").css({marginTop: "20px", height: "20px"});  //for example
   }
}

$(document).ready(function(){
   change_size();
});
$(window).resize(function(){
   change_size();
});
IVIajid
  • 190
  • 9