position的值为absolute或fixed时,优先级高于float

来源:互联网 发布:ubuntu恢复出厂设置 编辑:程序博客网 时间:2024/06/18 07:13
<!DOCTYPE html>  <html>  <head>      <title>demo</title>      <meta charset="utf-8">      <style type="text/css">          .c-1{              background-color: red;              width: 120px;             height: 120px;         }          .c-2{              background-color: yellow;              width: 50px;            height: 50px;           }          .c-3{              background-color: blue;              width: 100px;             height: 100px;         }      </style>  </head>  <body>     <div class="container" style="position:absolute; border:1px solid green;width:500px;">          <div class = "c-1"></div>          <div class = "c-2" style = "position:absolute;top: 10px;left: 10px;float:right; display:inline;"></div>          <div class = "c-3" ></div>    <div>    </body>  </html>  

这里写图片描述
这里写图片描述

display的值由inline变成了block,float的值由right变成了none。

阅读全文
0 0