I just want to make the div below some fixed texts, and I want the div to fill exactly the height of the page, and I want it to work in a cross browser ... It's hard to believe how much work this environmental task requires.
I tried this code that adjusts the height using jQuery. It works fine in Chrome, but it doesn't work fine in Chrome: if we scroll down, we can see that it does not automatically restore to its original position.
<!DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery.min.js"></script> <style> body { margin: 0 } .rb .myME { background: grey } </style> </head> <body> <div class="rb"> <div class="top">1<br/>2<br/>3<br/>4<br/></div> <div class="myME">abc</div> </div> <script> $(".myME").css({ height: (($(document).height()) - $(".top").height()) + 'px' }) </script> </body> </html>
Does anyone have the perfect solution (CSS or jQuery) cross browser?
javascript jquery css cross-browser height
SoftTimur
source share