- This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
Viewing 9 posts - 1 through 9 (of 9 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › 100% height not working
$(document).ready(function () {
$("#content").height($(document).height());
});
Using that bit of code to try to achieve my 100% height to my #content. However, its not working… Any ideas?
http://people.ysu.edu/~jtpenezich/tfts/
I solved my other javascript problems (don’t know how) but the smooth scroll is working correctly now, and I made it so my #page is always the length of the logo. However i’d like to try and get my #content to always fill up the screen.
I just got it working using the original code. Weird thing was, I didn’t change anything. For whatever reason either my computer or chrome was just going super slow, and now its working fine.
It isn’t appearing as 100%height for me
Yeah, I’m not sure whats going on. I think what is happening though is it renders as high as the browser is when you go to the site, but doesn’t expand past that
The document height is not the same as window height. document, html and body all have the same height, or usually do.
So, if you only have a few lines in your document, then the document height will be less than the window height, which is equal to the browser window height.
If you have a bunch of stuff in your document, like say this page, then the document/html/body height will be greater than the window height.
I almost always follow the rule:
html { height: 100%; }
body {height: 100%; }
#content {min-height: 100%; }
Thanks Sam!
That worked perfectly for me!
@Sam_Purcell, you should use min-height: 100%;
not height.
I tried with…
height: 110% ;
/* More / Less is up to you*/
It’s not the “right” way maybe, but it works fine.