Showing posts with label Style. Show all posts
Showing posts with label Style. Show all posts

Monday, July 11, 2011

how to keep footers at the bottom of the page (Modified)

On a previous post, I wrote about how to keep footers at the bottom of the page.
This post works great but while using it on a form I noticed that I need more modifications to it.

The first modification is that I used the form as the container.
The second one is to use a black background for the form to make sure that it stretched to the footer that is positioned on the bottom of the page.

In case of using a form you can use something like the following :

STYLE

html, body {
    margin:0;
    padding:0;
    height:100%;
    background-color:#23211d;
    font-size: .90em;
    font-family: "Helvetica Neue" , "Lucida Grande" , "Segoe UI" , Arial, Helvetica, Verdana, sans-serif;
    margin: 0px;
    padding: 0px;
}


#container {
    width:960px;
}


#headerLogo
{
    background-image:url('Images/webnew_header.jpg');
    height:141px;
}



#page
{
    background-color:Black;
    padding-bottom:200px;
  
}



#footer
{
    color:#464541;    
    background-color:Black;
    position:absolute;
    bottom:0;
    width:960px;
    height:200px;
}



Master Page


<body>
    <form id="Form1" runat="server" style="min-height: 100%; position: relative; background-color: Black;
    width: 960px;margin: 0px auto 0px auto;">
<table width="100%" cellpadding="0" cellspacing="0">
        <tr>
            <td align="center">
                <div id="container">
                    <div id="headerLogo">
                    </div>
                    <div id="page">
                        <asp:ContentPlaceHolder ID="MainContent" runat="server" />
                    </div>
                    <div id="footer">
                        <table width="100%" cellpadding="0px" cellspacing="0px">
                            <tr>
                                <td align="left" valign="bottom">
                                    All rights reserved for <a href="http://www.victorylink.com" target="_blank">Victory
                                        Link</a>
                                </td>
                                <td align="right">
                                    <asp:Image ID="imgTower" runat="server" Height="200px" ImageUrl="~/Styles/Images/lower_right_image.png"
                                        ImageAlign="Right" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>






Tuesday, April 12, 2011

How to keep footers at the bottom of the page

To keep footer at the bottom of the page is not that simple !
But after a long try I find it out and I am happy to share it with all of my visitors.

It's not that complicated after you got it. But the main solution is to divide your page into three divs inside a main container one.

so you have four divs :
1. Container
2. Header
3. Main
4. Footer

2,3 and 4 are inside 1

The styles below are required for that behavior, Of course it's better place would be on the master page.

html,
body {
margin:0;
padding:0;
height:100%;
}
#container {
min-height:100%;
position:relative;
}
#header {
padding:10px;
}
#body {
padding-bottom:60px; /* Consider Footer Height */
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:60px; /* Footer Height */
}

Modified on 11-07-2011
You can take a look at my next post on this topic