给float元素居中

分析


<div class="tc1">
        <div class="qd_an_1">
        <div>    <a href="javascript:void();" id="qin">已签</a></div>
        <div> <p>07月16日</p>
        <p>您有<i>1425412</i>金币</p>
   </div>
   </div>
         </div>


.tc1 {
  float: left;
  right: -50%;
  position: relative;
}<pre name="code" class="html">.qd_an_1 {
  background: #fff;
  border-radius: 5px;
  padding: 5px;
  float: left;
  position: relative;
  left: -50%;
}
<div class="header monospace" style="box-sizing: border-box; font-family: Consolas, 'Lucida Console', monospace; white-space: nowrap; color: rgb(34, 34, 34); widows: 1;"><div class="title styles-selector" style="box-sizing: border-box; cursor: text; word-wrap: break-word; white-space: normal;"><div style="box-sizing: border-box;"><div class="subtitle" style="box-sizing: border-box; color: rgb(85, 85, 85); float: right; margin-left: 5px; max-width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;"><a target=_blank class=" webkit-html-resource-link" title="http://csmb.cszhang.ecowe.net/templates/default/css/common_v9.css:6739" data-uncopyable="common_v9.css:6739" style="box-sizing: border-box; color: inherit; text-decoration: underline; cursor: pointer; display: inline-block;"></a></div><span class="selector" style="box-sizing: border-box; color: rgb(136, 136, 136);"><span class="simple-selector selector-matches" style="box-sizing: border-box; color: rgb(34, 34, 34);">.qd_an_1 div</span></span><span style="box-sizing: border-box;"> {</span></div></div></div><ol class="properties monospace" style="box-sizing: border-box; font-family: Consolas, 'Lucida Console', monospace; margin: 0px; padding: 2px 4px 0px 0px; list-style: none; clear: both; color: rgb(34, 34, 34); white-space: nowrap; widows: 1;"><li style="box-sizing: border-box; margin-left: 0px !important; padding-left: 38px; white-space: normal; text-overflow: ellipsis; overflow: hidden; cursor: auto;"><input class="enabled-button" type="checkbox" style="font-family: inherit; font-size: 10px; visibility: hidden; float: left; margin: 0px; vertical-align: top; position: relative; z-index: 1; width: 18px; left: -40px; top: 1px;" /><span class="styles-clipboard-only" style="box-sizing: border-box; display: inline-block; width: 0px; opacity: 0; pointer-events: none; white-space: pre;">  </span><span title="display: block;" style="box-sizing: border-box; color: rgb(200, 0, 0); margin-left: -38px;">display</span>: <span class="expand-element" style="box-sizing: border-box;"></span><span class="value" style="box-sizing: border-box;">block</span>;</li><li style="box-sizing: border-box; margin-left: 0px !important; padding-left: 38px; white-space: normal; text-overflow: ellipsis; overflow: hidden; cursor: auto;"><input class="enabled-button" type="checkbox" style="font-family: inherit; font-size: 10px; visibility: hidden; float: left; margin: 0px; vertical-align: top; position: relative; z-index: 1; width: 18px; left: -40px; top: 1px;" /><span class="styles-clipboard-only" style="box-sizing: border-box; display: inline-block; width: 0px; opacity: 0; pointer-events: none; white-space: pre;">  </span><span title="text-align: center;" style="box-sizing: border-box; color: rgb(200, 0, 0); margin-left: -38px;">text-align</span>: <span class="expand-element" style="box-sizing: border-box;"></span><span class="value" style="box-sizing: border-box;">center</span>;</li><li class="styles-panel-hovered" style="box-sizing: border-box; margin-left: 0px !important; padding-left: 38px; white-space: normal; text-overflow: ellipsis; overflow: hidden; cursor: auto;"><input class="enabled-button" type="checkbox" style="font-family: inherit; font-size: 10px; visibility: hidden; float: left; margin: 0px; vertical-align: top; position: relative; z-index: 1; width: 18px; left: -40px; top: 1px;" /><span class="styles-clipboard-only" style="box-sizing: border-box; display: inline-block; width: 0px; opacity: 0; pointer-events: none; white-space: pre;">  </span><span title="float: left;" style="box-sizing: border-box; color: rgb(200, 0, 0); margin-left: -38px;">float</span>: <span class="expand-element" style="box-sizing: border-box;"></span><span class="value" style="box-sizing: border-box;">left</span>;</li></ol><div style="box-sizing: border-box; color: rgb(34, 34, 34); font-family: Consolas, 'Lucida Console', monospace; white-space: nowrap; widows: 1;">}</div><div class="header monospace" style="box-sizing: border-box; font-family: Consolas, 'Lucida Console', monospace; white-space: nowrap; color: rgb(34, 34, 34); widows: 1;"><div class="title styles-selector" style="box-sizing: border-box; cursor: text; word-wrap: break-word; white-space: normal;"><div style="box-sizing: border-box;">
</div></div></div>




 











.qd_an_1 div  {
  1. displayblock;
  2. text-aligncenter;
  3. floatleft;
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值