Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: vertical align?

  1. #1
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,755
    Thanks
    41
    Thanked 191 Times in 190 Posts

    vertical align?

    So i usually never have a need for this; but i got bored today and decided to "play around" with an alternative i have read about to vertically align a div (note i usually do via other means)... first the code

    Code:
    <html>
    <head>
    <title>Starbuzz Coffee</title>
    <style type="text/css">
    #one{
    width:100%;
    height:50px;
    background:blue;
    }
    #main{
    display:table-cell;
    vertical-align:middle;
    width:300px;
    height:200px;
    background:orange;
    border:1px solid black;
    }
    </style>
    </head>
    
    
    <body>
    
    <div id="main">
    <div id="one">text to be centered
    </div>
    </div>
    
    </body>
    </html>
    so the only issue i have is with IE... FF and chrome both apply the "trick" but IE(9) completely ignores it. has anyone fiddled with this and know why it is not working? or an "hack" to make IE recognize?
    Again not really "high priority" i just got bored/distracted this morning. Also please no spams of things like
    "don't use IE" or
    "force users to use something other than IE" or
    well, you get the point.

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #2
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    I never use vertical-align

    hopefully this bump will help get an answer
    I know it could be very handy esp. when you want something vertically centered.


  •  

    Posting Permissions

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