css 居中
-----------------------
使用以上内容时,css是左对齐的,怎么样才能居中啊?
回复讨论(解决方案) text-align: center;text-decoration: none;background: #eaebd8;color: #2875de;font: 16px 宋体,arial;}/*字体*/#sddm div a:hover{ background: #49a3ff;color: #fff}
意思是在text-decoration: none;前面加入text-align: center;吗?
谢谢veryhunger,请问是改成这样吗?改了没效果。
-----------
#sddm
{ margin: 0 auto;
padding: 0;
z-index: 30;
background-color:#f4f4f4;
width: 100%;
height:23px;}
#sddm li
{ margin: 0;
padding: 0;
list-style: none;
float: left;
font: bold 16px 宋体}
#sddm li a
{ display: block;
margin: 0 1px 0 0;
padding: 4px 10px;
width: 100px;/*宽度*/
background: #5970b2;
color: #fff;
text-align: center;
text-decoration: none}
#sddm li a:hover
{ background: #49a3ff}
#sddm div
{ position: absolute;
visibility: hidden;
margin: 0;
/*padding: 0;*/
background: #eaebd8;
border: 1px solid #5970b2}
#sddm div a
{ position: relative;
display: block;
margin: 0;
padding: 5px 10px;
width: auto;
white-space: nowrap;
text-align: left;
text-align: center;
text-decoration: none;
background: #eaebd8;
color: #2875de;
font: 16px 宋体,arial;}/*字体*/
#sddm div a:hover
{ background: #49a3ff;
color: #fff}
--------
没有dom结构没法看
html代码贴出来撒! 一般都是固定宽度居中布局吧。width:500px; margin:0px auto; 这个就能居中
没有dom结构没法看
------------------------
代码如下:
nbsp;html public -//w3c//dtd xhtml 1.0 transitional//en http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd>
网站首页
网站首页
机构概况
信息公开
法律法规
宣传培训
办事指南
投诉举报
用户登录
代码见楼上,本来是回ly12530的。呵呵,请各位大神们指导一下,才开始学习,好多不懂。