Results 1 to 2 of 2

Thread: Vertical Align With CSS

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140

    Vertical Align With CSS

    This forum is quiet.

    I have the following:

    Code:
    <html>
      <head>
        <style type="text/css">
          body {
            text-align: center;
          }
          #myText {
            color: #00c000;
            background-color: transparent;
          }
        </style>
      </head>
      <body>
        <p id="myText">Kangaroo</p>
      </body>
    </html>
    I have the text aligned horizontally, but I can't figure out how to align it vertically. I have tried the vertical-align property on both the body and myText, but neither work.

    What am I doing wrong?
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I doesn't look like you can set valign using css

    perhaps a single cell table would do...

    Code:
    <html>
      <head>
        <style type="text/css">
          body {
            text-align: center;
    	
          }
          #myText {
            color: #00c000;
            background-color: transparent;
          }
        </style>
      </head>
      <body>
        
    
    <table width=100% height=100%>
    <tr><td valign=center align=center>
    
    <p id="myText">Kangaroo</p>
    
    </td></tr>
    </table>
    </body>
    
    </html>
    Mark
    -------------------

Posting Permissions

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



Click Here to Expand Forum to Full Width