给float元素居中

来源:互联网 发布:360压缩mac版 编辑:程序博客网 时间:2024/06/14 00:30

分析


<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;
}
0 0