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 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    centering content vertically

    hello i have a div inside of a div that contains 2 input's. i would like to center them according to the height of the parent divs height. setting verticle-align: to middle doesnt work. closest thing i got working is setting margin-top to 50px.

    ___main_div____
    | div1......|div2 |
    | html list | [<] |
    |.............| [>] |
    |________|____|
    Last edited by arianhojat; 12-01-2005 at 04:10 PM.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Post your code. That little image does nothing.

  • #3
    New Coder
    Join Date
    Dec 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't believe that vertical-align or valign applies to div. Maybe you can use tables instead and use <td valign=center>.
    Web hosting...webmaster support http://www.eofficeprofessionals.com/forums
    Offer solutions-not criticism.

  • #4
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by pramsey
    I don't believe that vertical-align or valign applies to div. Maybe you can use tables instead and use <td valign=center>.
    Using a table would withdraw benefits of using CSS.

    There's a search button on the forum, and the question about vertically aligning div's has been asked many times.

    Here's a quick link which should help you though -
    http://www.student.oulu.fi/~laurirai/www/css/middle/

  • #5
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,610
    Thanks
    0
    Thanked 645 Times in 635 Posts
    I have a page on how to centre align vertically using CSS at http://www.felgall.com/cshow02.htm
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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