开发者社区> 问答> 正文

div上还有一个div,如何把下层div中的元素显示出来?

screenshot

<div class="top">
    <ul>
        <li class="phone">
            <a href="#">手机</a>
            <span class="arrow"></span>
            <div class="t-pop"></div>
        </li>
        <li>
            服务
            <span class="arrow"></span>
        </li>
        <div class="clearfloat"></div>
    </ul>
</div>

<style>
    a {
        text-decoration: none;
    }
    .clearfloat {
        clear: both;
        height: 0;
        font-size: 1px;
        line-height: 0px;
    }
    ul {
        width: 300px;
        margin: 0;
        padding: 0;
        list-style: none;
        background-color: #ACE2AC;
        border-bottom: 1px solid #EEEEEE;
    }
    ul li {
        padding: 0px 50px;
        border-left: 1px solid #eee;
        border-right: 1px solid #eee;
        height: 50px;
        line-height: 50px;
        float: left;
        color: #666;
    }
    ul li a {
        color: #666;
    }
    ul li a:hover {
        color: #E4393C;
        text-decoration: underline;
    }
    ul li.phone {
        position: relative;
    }
    ul li span {
        display: block;
        position: absolute;
        margin-top: -28px;
        margin-left: 40px;
        width: 0;
        height: 0;
        border-width: 5px;
        border-style: solid;
        border-color: #666 transparent transparent transparent;
    }
    ul li div {
        position: absolute;
        width: 98px;
        height: 28px;
        top: 10px;
        left: 15px;
        background-color: #fff;
        border: 1px solid #ddd;
    }
</style>

展开
收起
a123456678 2016-03-26 15:34:28 2275 0
1 条回答
写回答
取消 提交回答
  • 解决了!把a,span标签加上z-index
    
        ul li a {
            position: relative;
            color: #666;
            z-index: 10;
        }
        ul li span {
            position: relative;
            display: block;
            position: absolute;
            margin-top: -28px;
            margin-left: 40px;
            width: 0;
            height: 0;
            border-width: 5px;
            border-style: solid;
            border-color: #666 transparent transparent transparent;
            z-index: 10;
        }
    2019-07-17 19:16:21
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载