1. 程式人生 > >html5之div居中

html5之div居中

效果如圖:

程式碼如下:

#navright {
            display: inline-block;
            vertical-align: middle;
            width:100%;
           
            height:100%;
            min-height:400px;   
            border:1px solid blue;
        }
        #txnavright {
            position: absolute;
            width: 100%;
            height: 300px;
            text-align: center;
            left: 0px;
            top: 0px;
            border:1px solid red;
           
        }
其中 必須包含一個父容器,和自容器,需要配合使用

忘了從網上哪裡找到的程式碼,這裡謝過~

撒花~~~