+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: IE8 centering vertically and horizontally

  1. #1
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    IE8 centering vertically and horizontally

    Hi

    I have a page that doesn't seem to be rendering in IE8, I have found out now that it's due to how it's being centred...

    my html:
    Code:
    <form id="form1" runat="server">
            <div class="login_form">
                <div style="padding-bottom:20px;">
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/images/verfin-logo.jpg" AlternateText="Verfin Logo" />
                </div>
                <div id="left">
                    <asp:Image ID="security" runat="server" ImageUrl="images/security.png" AlternateText="Security Image" />
                    <p>Welcome to VF-Finance Application</p>
    				<p>Use a valid username and password to gain access</p>
                </div>
                
                <div id="right">
                    <asp:Image ID="Login" runat="server" ImageUrl="images/login.gif" AlternateText="Login Image" />
                    <div id="login_form_inputs">
                        Username
                        <asp:TextBox ID="usrname" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="usrname" ErrorMessage="Please fill in your username"></asp:RequiredFieldValidator>
                    
                        Password
                        <asp:TextBox ID="psswrd" runat="server" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="psswrd" ErrorMessage="Please fill in your password"></asp:RequiredFieldValidator>
                        <br />
                        <asp:Button ID="btnLogin" runat="server" Text="Login" CssClass="button" />
                    </div>
                </div>
                <div class="clr" />
            </div>
        </form>
    
    my css:
    Code:
    /* ============================== BODY ============================== */
    	html,body {
    		margin-left: 0px;
    		margin-top: 0px;
    		margin-right: 0px;
    		margin-bottom: 0px;
    		padding:0px;
    		background-color:#FFFFFF;
    		font-family:Arial, Helvetica,  sans-serif;
    		width:100%;
    		height:100%;
    	}
    
    
    
    /* ============================== LOGIN ============================== */
    .login_form{
    		text-align:left;
    		padding:20px;
    		background-color:#F1F3F5;
    		border:1px solid #CCCCCC;
    		margin:0 auto;
    		
    		width:620px;
    		height:300px;
    		position: absolute;
    	    left: 50%;
    	    top: 50%;
    	    margin-left: -310px;
    	    margin-top: -150px;
    	}
    
    any ideas?

  2. #2
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    If I get a chance I'll put this up, but have you tried the page in FireFox? I've found the IE8 renders pages more correctly that previous versions (meaning more pages look incorrect) and closer to what FF produces.
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  3. #3
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    it works in everything except for IE8...

  4. #4
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Shem. The CSS style I use for my "container" div is:-
    Code:
    #container
    {
        top:40%;
        margin-top:-150px;
        border:solid 1px #CCCCCC;
        position:relative;
        margin-left: auto;
        margin-right:auto;
        width:40%;
        height:300px;
    }
    
    That would be the equivalent of your login_form style. If you have any other position:absolute's it might be worth changing those as well.

    Hope that helps.

    <edit>Just checked the other styles and no other position elements are used</edit>

  5. #5
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    Didn't work...

    here's my full css:
    Code:
    /* ============================== BODY ============================== */
    	html,body {
    		margin-left: 0px;
    		margin-top: 0px;
    		margin-right: 0px;
    		margin-bottom: 0px;
    		padding:0px;
    		background-color:#FFFFFF;
    		font-family:Arial, Helvetica,  sans-serif;
    		width:100%;
    		height:100%;
    	}
    
    
    
    /* ============================== LOGIN ============================== */
    .login_form{
    		text-align:left;
    		padding:20px;
    		background-color:#F1F3F5;
    		border:1px solid #CCCCCC;
    		margin:0 auto;
    		
    		width:620px;
    		height:300px;
    		position: relative;
    	    
    	    top:40%;
            margin-top:-150px;
            position:relative;
            margin-left: auto;
            margin-right:auto;
    
    	}
    	
    .button 
        {
    		background:#E9ECEF none repeat scroll 0%;
    		border:1px solid #CCCCCC;
    		color:#666666;
    		font-size:11px;
    		font-weight:bold;
    		padding:4px;
    	}
    	
    #login_form_inputs{
    		padding:20px;
    		background-color:#E9ECEF;
    		border:1px solid #CCCCCC;
    	}
    
    #left 
        {
            float:left;
            width:300px;
        }
        
    #right 
        {
            float:left;
            width:300px;
        }
    
    
    
    /* ============================== MISC ============================== */
    	.ctr {
    		text-align:center;
    	}
    	
    	.clr {
    		clear:both;
    	}
    
    also uploaded a pic of how it looks now
    Attached Images

  6. #6
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Hmm...The only difference I can see is you have this in yours:-
    Code:
    margin:0 auto;
    

  7. #7
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    removed it, no change...

  8. #8
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Hmm...Looks pretty much the same as my login page.
    Code:
        <form id="form1" runat="server" defaultfocus="txtUserName" defaultbutton="btnLogin">
        <div id="holder">
            <div id="container">
                <div id="logo">
                </div>
                <div id="main">
                    <div id="padlock">
                    </div>
                    <div id="content" class="size_10 bold blue_333399">
                        THIS IS A PRIVATE SITE<br />
                        UNAUTHORISED ACCESS IS NOT PERMITTED
                        <asp:panel ID="pnlLoginError" runat="server" CssClass="errorBox red" Visible="false">
                        <asp:Label ID="lblLoginError" runat="server" />
                        </asp:panel>
                        <asp:panel ID="pnlLogin" runat="server">
                            <ul class="input-fields">
                                <li>
                                    <asp:Label ID="lblUserName" runat="server" Text="Username" />
                                    <asp:TextBox ID="txtUserName" runat="server" CssClass="blue_333399 size_9 textbox"
                                        Width="200px" MaxLength="25" />
                                </li>
                                <li>
                                    <asp:Label ID="lblPassword" runat="server" Text="Password" />
                                    <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" CssClass="blue_333399 size_9 textbox"
                                        Width="200px" MaxLength="15" />
                                </li>
                                <li class="btn_20_10">
                                    <asp:LinkButton ID="btnLogin" runat="server" CssClass="lightblue _20 blue_333399 size_10" OnClick="btnLoginOnClick">Login</asp:LinkButton>
                                </li>
                            </ul>
                        </asp:panel>
                    </div>
                </div>
            </div>
        </div>
        </form>
    
    css
    Code:
    body
    {
        margin:0;
        padding:0;
        width:100%;
        height:100%;
        vertical-align:middle;
        text-align:center;
        font-family:Arial;
    }
    
    #container
    {
        top:40%;
        margin-top:-150px;
        border:solid 1px #CCCCCC;
        position:relative;
        margin-left: auto;
        margin-right:auto;
        width:40%;
        height:300px;
    }
    
    #logo
    {
        height:100px;
        width:357px;
        background-image:url('../images/logo.jpg');
        background-repeat:no-repeat;
    }
    
    #main
    {
        margin:0;
        margin-top:20px;
        width:100%;
        margin-left:auto;
        margin-right:auto;
    }
    
    #padlock
    {
        float:left;
        height:128px;
        width:90px;
        background-image:url('../images/padlock.png');
        background-repeat:no-repeat;
        margin-left:8px;
    }
    
    #content
    {
        margin-left:-98px;
        width:100%;
        overflow:hidden;
        float:right;
        text-align:center;
    }
    
    #pnlLogin
    {
        margin-top:8px;
    }
    
    Hope that helps.

  9. #9
    Barn Enthusiast Shem is on a distinguished road Shem's Avatar
    Join Date
    Mar 2008
    Posts
    305
    Rep Power
    4

    for interest sake RR, save as html page, with my css and html and see if it sits funny on your side?

    gonna do the same with your code and see if it sits funny my side...

  10. #10
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Tried it and it didn't appear right in mine either.

    Got a meeting now. Will take a look later Shem.

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. How to display data vertically from sql??
    By dtz in forum ASP Development
    Replies: 11
    Last Post: April 28th, 2009, 12:10 PM
  2. How to display data horizontally??
    By dtz in forum ASP Development
    Replies: 5
    Last Post: February 19th, 2009, 02:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO