• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

有了绝对定位之后为什么水平居中效果没有消失呢?

body{margin: 0;background:#333;}
ul{margin: 0;padding: 0;}
li{list-style: none;}
#pic{width: 400px;height:500px;position:relative;margin: 0 auto;}
#pic img{width: 400px;height:500px;}
#pic ul{position: absolute;top:0;right: -50px;}
#pic li{width: 40px;height: 40px;margin-bottom: 4px;background:#666;}
#pic .active{background:yellow; }
#pic p,#pic span{width: 400px;height: 30px;line-height: 30px;color:red;position: absolute;left:0;text-align: center;}
#pic span{top: 0;}
#pic p{bottom: 0;}





  

  数据加载中
  图片加载中

  

       

  •    

  •    

  •    

  •   





为什么我代码定位的是在父元素的left:0;处,显示的却是在水平居中位置呢?

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与1

不大理解你想问的意思,你是不是想要整块内容不居中呢?那么去掉#pic中的:margin: 0 auto;这个样式即可啦

使用道具 举报

发新帖

发布任务需求已有1031165位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!