HTML 5 Footer tag be always at bottom

后端 未结 6 531
挽巷
挽巷 2021-01-31 20:07

I am developing a site in HTML 5. I wrap all my footer content in footer tag. Like code below





<         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-31 20:30

    HTML5's footer tag doesn't magically put the contents at the foot of the page -- you still have to style it just as you always have. In that respect, it works exactly like a

    , so you should treat it as such by specifying CSS to make it display as intended:

    footer {
       //CSS code to make it display at the bottom, same as you would have done for a div.
    }
    

    Footers attached to the bottom of the page are known as "Sticky Footers". You can find more info about how to achieve the effect here: http://www.cssstickyfooter.com/

    The

    tag itself (along with all the other new HTML5 tags) is not there to do layout magic but for semantic purposes; ie to make it clear to someone reading the code (or more likely a bot) that the data inside the tag is footer data.

    In terms of browser support, all current browsers will allow you to specify the new HTML5 tags except IE, but fortunately all versions of IE (even IE6) can be forced to allow it by including the HTML5Shiv hack in your page.

    Hope that helps.

提交回复
热议问题