Web Analytics Made Easy -
StatCounter How to align this vertically? - CodingForum

Announcement

Collapse
No announcement yet.

How to align this vertically?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to align this vertically?

    In the HTML below I want to align the text vertically. But I don't know how to do it. Can anyone help?

    <html>
    <head>
    <style type="text/css"><!--
    #layer { position: absolute; top: 16px; left: 16px; width: 200px; height: 200px; border-style: dashed; border-color: red; visibility: visible }-->
    </style>
    </head>
    <body>
    <div id="layer">this text should be vertically aligned in this layer. But I don't how how to do it. </div>
    </body>
    </html>

    Kippie

  • #2
    #layer
    {
    ...
    text-align:center;
    ...
    }
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

    Comment


    • #3
      Vladdy, that align's the text horizontally.

      Code:
      vertical-align : 50%;
      Should work... I'm not sure though.
      I don't suffer from insanity, I enjoy every single minute of it!

      Comment


      • #4
        Thanks Vladdy,
        But I'm afraid you mean horizontal alignment. But I'm looking for vertical alignment.
        Kippie

        Comment


        • #5
          Thanks Flamerule,
          But this doesn't seem to work also. Who can help?
          Kippie

          Comment


          • #6
            oops... excuse my original brainfart....

            ...ok this works in Gekko browsers as it should....
            Code:
            #layer 
            { position: absolute;
              [COLOR="red"]display: table-cell;
              vertical-align: middle; [/COLOR]
              top: 16px; 
              left: 16px; 
              width: 200px; 
              height: 200px;
              border-style: dashed; 
              border-color: red; 
              visibility: visible;
             }
            but I guess you would have to do this to accomodate the stoopid IE:

            Code:
            <table id="layer">
            <td valign="center">this text should be vertically
             aligned in this layer.
             But I don't how how to do it.
            </td>
            </table>
            Last edited by Vladdy; Jul 9, 2002, 07:00 PM.
            Vladdy | KL
            "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

            Comment


            • #7
              Thanks,
              But is there no way to align vertically without using table commands?
              Kippie

              Comment


              • #8
                Code:
                <table id="layer">
                <td valign="center">this text should be vertically
                 aligned in this layer.
                 But I don't how how to do it.
                </td>
                </table>
                It's <td valign="middle">
                I don't suffer from insanity, I enjoy every single minute of it!

                Comment

                Working...
                X