Practical solution to center vertically and horizontally in HTML that works in FF, IE6 and IE7

后端 未结 5 575
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-20 21:28

What can be a practical solution to center vertically and horizontally content in HTML that works in Firefox, IE6 and IE7?

Some details:

  • I am lookin

5条回答
  •  情话喂你
    2020-12-20 22:06

    From http://www.webmonkey.com/codelibrary/Center_a_DIV

    #horizon        
        {
        text-align: center;
        position: absolute;
        top: 50%;
        left: 0px;
        width: 100%;
        height: 1px;
        overflow: visible;
        display: block
        }
    
    #content    
        {
        width: 250px;
        height: 70px;
        margin-left: -125px;
        position: absolute;
        top: -35px;
        left: 50%;
        visibility: visible
        }
    
    

    This text is
    DEAD CENTRE
    and stays there!

提交回复
热议问题