Can you help me understand how to center text vertically within a DIV that
is also center on the page?

 

I am trying to position a DIV in the center of the page and then place text
on the right side and centered vertically within the DIV.

 

I can center the DIV with this definition. I color the background so you can
see the DIV.

#header-topnav {

                position: relative;

                background-color: red;

                height: 33px;

                width: 950px;

                margin-left:auto;

                margin-right:auto;

                text-align:right;

} 

 

I can get the text to center vertically with this definition

#header-topnav {

                position: relative;

                background-color: red;

                height: 33px;

                width: 950px;

                margin-left:auto;

                margin-right:auto;

                text-align:right;

                display:table-cell;

                vertical-align: middle;

}

But when I add the display:table-cell, it causes the DIV to left align.

 

How can I vertically align the text and keep the DIV  in the middle of the
page?

 

Here is the page www.HPS02.com/index.php

 

 

______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to