Html 如何将li元素水平居中
我在我的电脑上使用domtab,但由于某些原因,我无法将li元素(其中包含ver1、ver2、TOUS LES电影、AFFICHAGE HORAIRE等)或ul块居中 以下是与domtab相关的代码:Html 如何将li元素水平居中,html,css,tabs,Html,Css,Tabs,我在我的电脑上使用domtab,但由于某些原因,我无法将li元素(其中包含ver1、ver2、TOUS LES电影、AFFICHAGE HORAIRE等)或ul块居中 以下是与domtab相关的代码: #domtab_main{ width:600px; margin:20px auto; position:relative; /*height: 100px;*/ } ul.domtabs{
#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;
}
我在评论中所做的就是我所尝试的。
请问有什么解决办法吗?就是这样的问题:
我已经为你的页面测试过了。它们已经对齐了。对不起,我想说:把它们水平地放在页面中间。你在说什么<代码> LI>代码>?它们太多了:有ver1,ver2,TOUS LES电影,AFFICHAGE HORAIRE。。。感谢您,标签的第一级现在居中(第1版,第2版,…),但是
我们的LES电影
和AFFICHAGE HORAIRE
仍在左侧。我用firebug检查了一下,但是没有左边、边距和填充。它现在可以工作了,我必须删除填充:1em 3em代码>来自div.domtab div
,谢谢:)