4-2<i>标签的定位

来源:4-2 导航菜单样式

qq_涟_0

2017-08-01 13:06:07

http://climg.mukewang.com/598030ae0001797004150198.jpg

http://climg.mukewang.com/598030ae00010d0803450238.jpg

http://climg.mukewang.com/598030ae00010a5105860490.jpg

http://climg.mukewang.com/598030af0001302104290385.jpg

为啥说在menu-item没有 position:relative;之前<i>元素是以menu-content为定位祖先元素吗?menu-content的position属性不是absolute吗?,<i>元素不是应该以main为定位祖先元素吗?

写回答

2回答

qq_天天_66

2017-08-01

你贴个代码上来,我不是很清楚你说的是什么?

你的意思是menu-item 和menu-content是兄弟元素,main是他们共同的祖先元素吗?

绝对定位的参照可以是祖先元素的相对定位和绝对定位

0
hq_涟_0
回复
hlafChou
h 我理解没有错,你看我下面的答复
h017-09-01
共5条回复

qq_涟_0

提问者

2017-09-01

http://climg.mukewang.com/59a8bf960001179e01070104.jpg

 section.father{
            width: 100px;
            border:#000 1px solid;
            height:100px;
            background:#ccc;
            position:relative; //即使这句注释掉,son-son也会根据son定位
        }

        div.son{
             width: 50px;
            border:#000 1px solid;
            height:50px;
            background:#fff;
            position:absolute;
            left:10px;
            top:10px;
        }
        .son-son{
             width:20px;
            border:#000 1px solid;
            height:20px;
            background:#ccc;
            position:absolute;
             left:10px;
            top:10px;
        }
        *{
            margin:0;
            padding:0;
        }
        
         <section class="father">
        <div class="son">
            <div class="son-son"></div>
        </div>
    </section>


0
hlafChou
h 你可以看看我刚提问的,我打算问老师了。
h017-09-02
共1条回复

0 学习 · 36712 问题

查看课程