I've spent the past two days troubleshooting this problem for my portfolio website, and have yet to find a solution.
我花了两天时间为我的投资组合网站解决这个问题,并且还没有找到解决方案。
The basic structure of the page is a header, a wrapper for content (nav bar and content divs), and the footer. The problem is that the footer is cutting through the middle of the wrapper div, making the content run around and below the footer. I would post a screenshot, but I don't have enough reputation.
It looks like the div containing the résumé info is the only one causing the problem, whereas the footer is only corresponding to the nav bar.
看起来包含简历信息的div是导致问题的唯一一个,而页脚仅对应于导航栏。
Code is below.
代码如下。
Additional info: When I tried setting the footer's position to fixed, it disappears completely from the page. I also tried removing the .wrapper div and just using the content divs. I also tried changing the positions of the divs to absolute and relative.
Also, if you have suggestions for making this a better question, or for better code, please let me know. Thank you for any help.
另外,如果您有建议将此问题作为更好的问题或更好的代码,请告知我们。感谢您的任何帮助。
2 个解决方案
#1
2
Okay, so I have a few suggestions. You can go look at the updated jsFiddle, here:
好的,我有一些建议。您可以在这里查看更新的jsFiddle:
http://jsfiddle.net/tf4cq/1/
http://jsfiddle.net/tf4cq/1/
Basically, there isn't any good reason to have .content positioned absolutely. You floated the sidebar (your nav menu), so to make sure the content lines up correctly on the left side, just add a left-padding value equal to or greater than the width of the sidebar.
The reason your footer doesn't wind up where you thought it should is that the two elements above it (the nav bar and the content) are both taken out of the normal document flow as soon as you apply either float or position: absolute (or fixed, for that matter).
What I (stupidly) realized was that the DOCTYPE says html5, when html is the correct declaration. @TiesonT. thank you for helping. Changing the DOCTYPE solved the problem.