在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML5  HTML/ 設(shè)置導(dǎo)航欄fixed的問題,子元素不能隨父元素固定?

設(shè)置導(dǎo)航欄fixed的問題,子元素不能隨父元素固定?

html代碼如下

<div class="banner clearf">
    <div class="logo">
        <a href= "lbt.html" id="logo">乎之</a>
    </div>
    <div class="banner-container ">
        <div class="item">1</div>
        <div class="item">2</div>
        <div class="item">3</div>
    </div>
</div>

css如下
.banner{

width: 100%;
display: block;
position: fixed;
top: 0;
background-color: rgba(255, 255, 255, 1);
height: 70px;
box-shadow:0 3px 5px rgb(118, 231, 217);
border-radius: 1px;
z-index: 100;

}

logo {

display: block;
text-decoration: none;
height: 70px;
margin-left: 15%;
color: rgb(104, 105, 236);
font-size: 3em;

}
.clearf::after{

clear: both;

}
.clearf::before{

clear: both;

}
.banner-container {

top: -100px;
height: 100%;
width: auto;
border: 1px solid black;
border-color: rgb(110, 56, 28);

}
.banner-container .item{

float: left;

}

banner-container里面的內(nèi)容不能隨父級div banner固定在頂部
請問哪里出了問題
定位position問題還是float的問題?

clipboard.png

回答
編輯回答
久礙你

logo的display:inline-block.
block會占據(jù)行。
你給的碼不全,css的logo是a的嗎?這樣寫很不規(guī)范耶

2017年9月24日 16:17
編輯回答
陌璃

你給.banner{height:70px;} .banner-container{height:70px; } 父級都裝不下了你說他換行不

2018年7月2日 05:25
編輯回答
柒喵

怎么不能固定了,可以的啊

2017年10月21日 12:17