SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    Ho Chi Minh City Vietnam
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Vertically Aligning Text

    I have created a webpage with 3 div tags #top, #center, #bottom. Each div has been assigned a width measurement of 100% and their height measurements are in percentage and collectively add up to 100%. The #top div has a single line of introductory text which I have horizontally aligned with

    text-align: center;

    Now I am trying to vertically align the text in the middle of the div. The tag takes up 32% of the browser window. I have attributed the following code to my div tag #top, but it's creating way to much space

    padding-top: 50%;

    I am assuming that the div tag is a block element and that a 50% attribute will place my text in the middle of the space created by the div tag. Obviously this is not the best way to approach this problem. I would be grateful for the best solution to the problem.

    Thanks in Advance Last Radius

  2. #2
    SitePoint Addict
    Join Date
    Oct 2003
    Location
    United States
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    have you tried vertical-align: center; ? PErhaps you can even try padding-top: auto; padding-bottom: auto;

    I'm not that fluent in CSS yet, but those are some ideas you can try to play around with to see if they can produce the results you want.

    I suggest you post your code up so others who actually know what they are doing can play around and figure out the problem


Bookmarks

Posting Permissions

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