广告合作
  • 今日头条

    今日头条

  • 百度一下

    百度一下,你就知道

  • 新浪网

    新浪网 - 提供新闻线索,重大新闻爆料

  • 搜狐

    搜狐

  • 豆瓣

    豆瓣

  • 百度贴吧

    百度贴吧——全球领先的中文社区

  • 首页 尚未审核订阅工具 订阅

    css设置模态框如何显示在最上层

    来源:网络收集  点击:  时间:2024-05-22
    【导读】:
    css不同的div之间的层级关系是通过css的z-index属性以及position属性共同控制。工具/原料morehtml和cssz-index属性与position属性方法/步骤1/2分步阅读

    初始代码如下:

    html

    head

    title/title

    /head

    style type=text/css

    .red{

    width:100px;

    height: 100px;

    background: red;

    position: absolute;

    }

    .yellow{

    width: 200px;

    height: 100px;

    background: yellow;

    position: absolute;

    }

    /style

    body

    div class=red/div

    div class=yellow/div

    /body

    /html

    可以看出橙色的div明显在红色的div上面,现在使用z-index属性控制红色div在橙色div上面。

    2/2

    代码如下:

    html

    head

    title/title

    /head

    style type=text/css

    .red{

    width:100px;

    height: 100px;

    background: red;

    position: absolute;

    z-index: 11;

    }

    .yellow{

    width: 200px;

    height: 100px;

    background: yellow;

    position: absolute;

    }

    /style

    body

    div class=red/div

    div class=yellow/div

    /body

    /html

    效果如下图:

    本文关键词:

    版权声明:

    1、本文系转载,版权归原作者所有,旨在传递信息,不代表看本站的观点和立场。

    2、本站仅提供信息发布平台,不承担相关法律责任。

    3、若侵犯您的版权或隐私,请联系本站管理员删除。

    4、文章链接:http://www.1haoku.cn/art_825139.html

    相关资讯

    ©2019-2020 http://www.1haoku.cn/ 国ICP备20009186号05-05 17:11:51  耗时:0.034
    0.0343s