老师,为什么我的a1下menu菜单栏那个橙色盒子显示不出来呢。

来源:2-7 使用CSS制作菜单

Vigorous阿炎

2020-10-23 17:20:17

css.css

.header-top{

    height150px;

    background-color: rgb(228187187);

}

.A{

    height32px;

    background-color#2A2A2A ;

    line-height32px;

}

.header-top .A .center-wrap{

  

}

.header-top .A .center-wrap .right .iconfont{

    floatright;

    margin-right16px;

    line-height32px;

}

.header-top .A .center-wrap .right .iconfont:first-child{

    margin-right0;

}


.header-top .A .center-wrap .right .dr,.zc{

    font-size12px;

    color#FFFFFF;

    text-alignjustify;

    line-height32px;

}

.header-top .A .center-wrap .A1{

    floatleft;


}

.header-top .A .center-wrap .A1ulli{

    /* 大于号表示父亲的第一任儿子 */

    font-size14px;

    floatleft;

    margin-right18px;

}

.header-top a{

    font-family: PingFangSC-Regular;

   

    color#FFFFFF

    text-alignjustify;

    line-height18px;

}

.header-top .A .center-wrap .A1ulli.a1{

    /* li里面本身的一个a1元素用交集 */

    

    padding-right:12px;

    positionrelative;

}

header-top .A .center-wrap .A1>ul>li.a1 .menu{

    /* 为什么我的盒子没显示出来,难道是溢出隐藏掉了 */

    positionabsolute;

    bottom30px;

    right0;

    width300px;

    height400px;

    background-color: rgb(138230102);

    z-index9999;

}

.header-top .A .center-wrap .A1ulli.a1 .B{

    positionabsolute;

    right0;

    top50%;

    margin-top-6px;

    width12px;

    height12px;

    

    transition: transform 0.2s linear 0s;

}

.header-top .A .center-wrap .A1ulli.a1:hover .B{

    transform:rotate(180deg)

}

/* 先两个盒子使用绝对定位然后微调,然后大盒子hover,

    之后控制大盒子transition旋转速度 */

.header-top .A .center-wrap .A1ulli.a1 .B .aa1{

    positionabsolute;

    left2px;

    top4px;

    width6px;

    height6px;

    background-color: rgb(248248246);

    transform: rotate(45deg);

}

.header-top .A .center-wrap .A1ulli.a1 .B .aa2{

    positionabsolute;

    top2px;

    left2px;

    width6px;

    height6px;

    background-color#2A2A2A;

    transform: rotate(45deg);

}

html

<!DOCTYPE html>

<html lang="en">


<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>慕云游</title>

    <meta name="keywords" content="旅游,机票,观光,休闲">

    <meta name="Description" content="旅游好地方,给你身心放个假,

    机票,度假,观光,休闲旅游必去的地方">


    <link rel="stylesheet" href="CSS/reset.css">

    <link rel="stylesheet" href="CSS/base.css">

    <link rel="stylesheet" href="CSS/css.css">

</head>


<body>

    <head>

        <header class="header-top site-head">

            <!-- 整个页面区域 -->

            <div class="A topbar">

                <!-- 中间上半部分区域,还有下半部分所以需要分区 -->

                <div class="center-wrap">

                    <!-- 正式编辑区 -->

                  

                    <div class="A1">

                        <ul>

                            <li>

                                <a href="">目的地</a>

                            </li>

                            <li>

                                <a href="">锦囊</a>

                            </li>

                            <li class="a1">

                                <a href="">社区</a>

                                <div class="B">

                                    <em class="aa1"></em>

                                    <em class="aa2"></em>

                                </div>

                            </li>

                            <li> 

                                <a href="">行程助手</a>

                                

                            </li>

                            <li class="a1">

                                <a href="">商城</a>

                                <div class="B">

                                    <em class="aa1"></em>

                                    <em class="aa2"></em>

                                </div>

                            </li>

                            <li class="a1">

                                <a href="">酒店民宿</a>

                                <div class="B">

                                    <em class="aa1"></em>

                                    <em class="aa2"></em>

                                </div>

                                <div class="menu"></div>

                            </li>

                            <li>

                                <a href="">特价酒店</a>

                            </li>

                        </ul>

                    </div>

                    <div class="right">

                        <a class="iconfont dr" href="">登入</a>

                        <a class="iconfont zc" href="">注册</a>

                        <a class="iconfont" href="">&#xe699;</a>

                        <a class="iconfont" href="">&#xe66c;</a>

                        <a class="iconfont" href="">&#xe609;</a>

                        <span class="iconfont">|</span>

                        <a class="iconfont" href="">&#xe602;</a>

               

                        

                    </div>

                </div>

            </div>

http://img.mukewang.com/climg/5f9294b909b5dc7300000000.jpg在这里输入代码,可通过选择【代码语言】突出显示

写回答

3回答

好帮手慕言

2020-10-27

同学你好,是指把下方代码修改为bottom和right吗?

http://img.mukewang.com/climg/5f92bc6609bef81a06920180.jpg

如果是的话,那么解答如下:

类名为a1的元素设置了定位,类名为menu的元素是相对于a1定位的,如果menu的bottom属性设置为0,menu的底部会在a1的底部显示,因为a1已经在页面的最上方了,menu的高度比a1的大,所以menu会被覆盖一部分。

建议:可以把bottom值设置为负值,也可以把right和bottom值替换为left和top值,祝学习愉快~

0

Vigorous阿炎

提问者

2020-10-23

可是当我设置right  和bottom值时,发现橙色盒子不是在右下角出现的。位置出现的不对。

0

好帮手慕言

2020-10-23

同学你好,相似的问题,在同学的另一个提问中解答了,快去查看吧,链接:http://class.imooc.com/course/qadetail/261217,祝学习愉快~

0

0 学习 · 15276 问题

查看课程