2017-04-02 16 views
0

fixedを描画する場所にdivを作成することはできますか(標準で 'static/relative'の位置です)?divを相対位置に固定した位置に設定する

div .one.three.fourは最初に描画される場所に固定します。それはスクロールしないように。 https://jsfiddle.net/sor8hntk/2/

+0

このようにしますか? https://jsfiddle.net/repzeroworld/96g3pLmc/ – repzero

+0

あなたの期待する結果が明らかになるまで、私の答えを取り消してください。 – repzero

答えて

0

はい! https://jsfiddle.net/sor8hntk/7/

body { 
    margin-top:40px; 
} 

.one { 
    float:left; 
    background-color:green; 
    width:33%; 
    height:50px; 
    position: fixed; 
} 
.two { 
    float:left; 
    background-color:red; 
    width:33%; 
    height:500px; 
    left: 33%; 
    position: absolute; 
} 

.three { 
    float:left; 
    background-color:blue; 
    width:33%; 
    height:50px; 
    position: fixed; 
    left: 66%; 
} 

.four { 
    width:33%; 
    background-color:purple; 
    height:10px; 
    position: fixed; 
} 

.five { 
    width:100%; 
    background-color:pink; 
    margin-top: 10px; 
} 

.six { 
    width:100%; 
    height:10px; 
    background-color:yellow; 
} 
関連する問題