2017-04-02 2 views
0

Ist es möglich, ein div fixed an der Stelle zu machen, an der es gezeichnet wird (es ist Standard 'static/relative')?div auf feste Position an der relativen Position setzen

Also ich möchte div .one, .three und .four an der Stelle fixiert werden, wo es zunächst gezeichnet wird. Damit es nicht scrollt. https://jsfiddle.net/sor8hntk/2/

+0

gefällt das? https://jsfiddle.net/repzeroworld/96g3pLmc/ – repzero

+0

Zurückziehen meiner Antwort, bis Sie Ihre erwarteten Ergebnisse klären. – repzero

Antwort

0

Ja! 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; 
} 
Verwandte Themen