2013-07-18 93 views
0

我在我的site上使用domtab,但由於某些原因,我無法居中li元素(用ver1,ver2,TOUS LES FILMS,AFFICHAGE HORAIRE,...寫成的元素他們)或ul塊。如何將li元素水平居中

這裏是相對於domtab代碼:

#domtab_main{ 
     width:600px; 
     margin:20px auto; position:relative; 



     /*height: 100px;*/ 
    } 

    ul.domtabs{ 
     position: relative; 
     /*float:left;*/ 
     /*width:100%;*/ 
     width: 600px; 
     /*margin : 0 auto;*/ 
     /*padding-left: 110px;*/  
     font-family: MS Courier New; 
     font-size: 17px;  
     /*padding:0;*/ 
     /*text-align:center;*/ 


     padding: 0px; 
     /*list-style: none;*/ 
     margin-right: auto; 
     margin-left: auto; 
     margin-top: 0px; 
     margin-bottom: 0px; 
     left: auto; 

    } 
    ul.domtabs li{ 
     list-style:none; 
     float:left; 
     padding:0 .5em 0 0; 
    } 


    ul.domtabs a:link, 
    ul.domtabs a:visited, 
    ul.domtabs a:active, 
    ul.domtabs a:hover{ 
     /*width: 170px;*/ 
     padding:10px; 
     display:block; 
     /*background:#666; 
     color:#ccc;*/ 
     height:3em; 
     /*font-weight:bold;*/ 
     text-decoration:none; 

     color:#f0f0f0; 
     background: -moz-linear-gradient(top, #117586 0%, #158CA1 100%); 
     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#117586), color-stop(100%,#158CA1)); 
     background: -webkit-linear-gradient(top, #117586 0%,#158CA1 100%); 
     background: -o-linear-gradient(top, #117586 0%,#158CA1 100%); 
     background: -ms-linear-gradient(top, #117586 0%,#158CA1 100%); 
     background: linear-gradient(top, #117586 0%,#158CA1 100%); 
     filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#117586', endColorstr='#158CA1',GradientType=0); 


    } 


    div.domtab div{ 
     clear:both; 
     width:auto; 
     /*background:#696;*/ 
     color:#000; 
     padding:1em 3em; 
     padding-bottom: 0; 
    } 

我把什麼評論是我的嘗試。 請問有沒有解決方法?

+0

它們已經對齊。 – Nitesh

+0

對不起,我想說:將它們水平放置在頁面中間。 – Exia0890

+0

你在說什麼?其中有太多:S –

回答

1

這是確切同樣的問題是這樣的:How do I center list items inside a UL element?

我測試過的soultion您的頁面。

+0

感謝第一級選項卡現在居中(ver1,ver2,...),但是「TOUS LES FILMS」和「AFFICHAGE HORAIRE」仍然在左側。我用螢火蟲檢查過,但沒有剩餘,邊距,填充。 – Exia0890

+0

請更新您的在線代碼,以便我們可以檢查此 –

+0

對不起,現在已更新。 – Exia0890