随笔记录方便自己和同路人查阅,学习CSS时最好先学会HTML。

#------------------------------------------------我是可耻的分割线-------------------------------------------

三种颜色,绿色、黑色和白色使用z-index来控制层级显示

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div style="z-index:10; position: fixed;top: 50%;left:50%;
    margin-left: -250px;margin-top: -200px; background-color:white;height: 400px;width:500px; ">
        <input type="text" />
        <input type="text" />
        <input type="text" />
    </div>
    <div style="z-index:9; position: fixed;background-color: black;
    top:0;
    bottom: 0;
    right: 0;
    left: 0;
    opacity: 0.5;
    "></div>
    <div style="height: 5000px;background-color: green;">
        asdfasdf
    </div>
</body>
</html>

 

效果:

CSS基础(二十一)--Position之调整层级位置

z-index的数那个大那个在上面,以上代码10 在最外层然后是9

 

相关文章:

  • 2021-04-02
  • 2022-12-23
  • 2022-01-11
  • 2021-09-11
  • 2021-09-27
  • 2021-08-18
  • 2021-12-31
  • 2022-02-22
猜你喜欢
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-12-26
  • 2021-10-09
相关资源
相似解决方案