Vertical Align a <DIV>

Discussion in 'HTML and CSS' started by xarzu, Oct 19, 2011.

  1. xarzu

    xarzu

    Joined:
    Apr 3, 2007
    Messages:
    8
    I have managed to horizontally align a Div object. Here is how I did it. I got the width and the height of the object I wanted to center (XAML CODE)

    HTML:
    <Grid  Background="White" Height="300" Width="738" VerticalAlignment="Center" HorizontalAlignment="Center">
    Then, in the html file that hosts the silverlight control I did this:

    HTML:
     <div id="silverlightControlHost" style="width:738px; height: 300px;  margin-top:auto; margin-bottom:auto;   margin-left: auto; text-align:center; margin-right: auto;">
    That puts the control centered horizontally at the top of the web page.

    Now, how do I center it vertically?
     
    xarzu, Oct 19, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kay
    Replies:
    2
    Views:
    7,211
  2. Jochen Fuhrmann

    vertical-align and div

    Jochen Fuhrmann, Oct 6, 2003, in forum: HTML
    Replies:
    1
    Views:
    24,502
    Steve Pugh
    Oct 6, 2003
  3. Tobias Müller

    div and vertical align

    Tobias Müller, Nov 25, 2003, in forum: HTML
    Replies:
    2
    Views:
    697
    Steve Pugh
    Nov 25, 2003
  4. Paul Lautman
    Replies:
    6
    Views:
    50,181
    Yucky Korpulent
    Apr 3, 2006
  5. =?UTF-8?B?TWFydGluIFDDtnBwaW5n?=

    [CSS] Div-Tag and Vertical Align

    =?UTF-8?B?TWFydGluIFDDtnBwaW5n?=, Aug 19, 2006, in forum: HTML
    Replies:
    6
    Views:
    22,589
    dorayme
    Aug 22, 2006
Loading...

Share This Page