为了账号安全,请及时绑定邮箱和手机立即绑定

margin-left:auto; margin-right:autoh失效;

margin-left:auto; margin-right:autoh失效;

wxx 2015-04-15 11:08:24
@charset "utf-8";/* CSS Document *//*公用*/.comwidth{width:1000px; margin-left:auto; margin-right:auto;}.leftArea{float:left;}.rightArea{float:right;}.hide{display:none;}.show{display:block;}/*topBar*/.topBar{height:31px; background-color:#f7f7f7;line-height:31px;}.collection{ background:url(../images/icon/collection.jpg) left center no-repeat; padding-left:19px;font-weight:bold;}.topBar a:hover{ color:#F00;}/*logo*/.logoBar{ height:85px; background-color:#1D7AD9;}.logo{ padding-left:41px; padding-top:13px;}/*search*/.secarch_box{width:430px; padding-top:23px; padding-left:185px;}.search_text{width:350px;height:35px; line-height:35px\9;/*css hack  \9 代表所有的ie浏览器*/ padding:0 5px; background-color:#FFF;}.search_btn{width:70px; height:35px; font-size:14px; font-family:"Microsoft YaHei", "微软雅黑"; background-color:#FF8C00; color:#FFF;}/*购物车*/.shopCar{width:145px; height:35px;background-color:#FF8C00; margin-top:23px;font:14px/35px "Microsoft YaHei", "微软雅黑"; color:#FFF; margin-right:59px; display:inline;}.shopText{/*font-size:14px; font-family:"Microsoft YaHei", "微软雅黑"; line-height:35px;*/  height:100%; width:87px; border-right:#E27A00 solid 1px; background:url(../images/icon/shaoIcon.jpg) 10px center no-repeat; text-indent:40px;}.shopNum{width:27px; height:35px; border-left:#FF9C01 solid 1px; background:url(../images/icon/sj.jpg) 33px center no-repeat; text-align:right; padding-right:29px;}/*导航栏*/.navBox{height:35px; background-color:#1369C0;color:#fff; }.shopClass{width:190px; position:relative; }.shopClass h3{ text-align:center; line-height:35px;}.shopClass i{ width:11px; height:7px; overflow:hidden; background:url(../images/icon/down.jpg) left center no-repeat; display:inline-block; margin-left:11px;}.nav,.shopClass{font-family:"Microsoft YaHei UI", "微软雅黑";}.nav{line-height:35px;}.nav li{float:left;}.nav a{ height:35px; display:inline-block; padding:0 35px; color:#fff;}.nav .activer{ background-color:#4593FD;}/*商品弹出列表*/.shopClass_show{background-color:#4593Fd;position:absolute; left:0; top:35px; width:100%;}.shopClass_item{padding:14px 10px; border-bottom:#3487F2 solid 1px; border-top:#5AA1FE solid 1px;}.shopClass_item dt{height:20px; background:url(../images/icon/shop_sj.jpg) right center no-repeat;} .shopClass_item .big{ font:14px/1 "Microsoft YaHei UI", "微软雅黑";}.shopClass_item a{color:#fff; text-decoration:underline;}.shopClass_item .alink{width:48px; height:20px; background:url(../images/icon/aLink_bg.png) left center no-repeat; display:inline-block; text-align:center; line-height:20px; text-decoration:underline;}/*banner*/.banner{ margin-bottom:15px;}.banner_bar{width:810px; height:325px; float:right; position:relative; overflow:hidden;}.imgbox{ width:1620px; height:325px; position:absolute; left:0px; top:0;}.imgbox ul{padding:0; margin:0;}.imgbox li{float:left;}.imgbox img{width:810px; height:326px; display:block;}.imgnum{position:absolute; left:0; bottom:15px; width:100%; text-align:center;}.imgnum a{width:20px;height:5px; overflow:hidden; background-color:#fff; display:inline-block; margin:0 3px;}.imgnum .active{background-color:FF7700;}/*商品*/.shoptit{ height:44px; font-family:"Microsoft YaHei UI", "微软雅黑"; line-height:44px; margin-bottom:15px;}.shoptit h3{font-size:24px; float:left; font-weight:normal; padding-left:15px;}.icon{width:44px; height:44px; background:url(../images/icon/shopIcon.jpg) left top no-repeat; float:left;}.more{float:right; font-family:"宋体";}.more:hover{text-decoration:underline;}.shoplist{ float:left; }/*商品列表*/.shoplist .leftArea{width:190px;}.shoplist .rightArea{width:808px; border:#999 solid 1px; border-bottom:#FF7201 solid 3px; height:396px; overflow:hidden;}
查看完整描述

3 回答

?
sdwsq

TA贡献19条经验 获得超3个赞

想居中 元素必须有宽度 而且是diaplay:block  浮动会让居中失效

查看完整回答
反对 回复 2016-10-18
  • sdwsq
    sdwsq
    我的方法是在inline-block的外部加个父级div 父级DIV 居中
?
eko4107343

TA贡献5条经验 获得超1个赞

把html贴出来啊


查看完整回答
反对 回复 2016-10-18
?
Tobey_滔

TA贡献242条经验 获得超128个赞

如果你想一个容器左右居中的话....可以使用margin:0 auto;即可

查看完整回答
反对 回复 2016-10-18
  • chrisliu
    chrisliu
    display: inline-block; margin:0 auto; 此时这个元素就不居中了,这是为什么呢
  • 3 回答
  • 0 关注
  • 5649 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信