1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Horizontal and Vertical centered div

Discussion in 'Web Design, HTML And CSS Forums' started by webwss, May 19, 2009.

  1. webwss

    webwss New Member

    Joined:
    May 19, 2009
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Can anybody share code for Horizontal and Vertical centered div as I am not able to get it.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Try

    HTML:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <style>
    div.album {
    padding-top:25%;
    height:50%; 
    width:100%; 
    background-color: green; 
    text-align:center;
    vertical-align:middle;
    }
    </style>
    </HEAD>
    <BODY>
    <div class="album">
    This is some text
    </div> 
    </BODY>
    </HTML>
    
     

Share This Page