-5

I am new to web styling , so please bear with me .I have a html content and a style sheet as below and it works just fine without the floating footer issue. But a lot of solutions have been created by various developers and I am sure for a good reason (eg. http://ryanfait.com/resources/footer-stick-to-bottom-of-page/). I would like to know if the css defined for the below page layout to keep the footer at the bottom of the page is insufficient and if it will create a problem in future in some scenario.

CSS :

html,body {
    height:100%;
}

#body {
height:75%;
} 

HTML

 <html lang="en">
        <head id="myHeader" title="Hello sample">
            <style type="text/css">
                html,body {
                     height:100%;
                    }
                #body {
                   height:80%;
                      }
            </style>
        </head>
        <body>
                <div>
                    <div >
                        <p> This is the header </p>
                    </div>
                </div>

            <div id="body" >
               <div >
                        <p> This is the body </p>
                </div>
            </div>
                <div >
                   <div >
                        <p> This is a footer </p>
                </div>
                </div>
        </body>
    </HTML>
4

1 回答 1

1

尝试让你的页脚 CSS 像这样:

position:absolute;
bottom: 0px;
于 2013-06-11T12:33:04.387 回答