2015-01-01 2 views
0

사이드 바 및 navbar가 고정되어 있으며 각 기사의 너비에 따라 사이드 바의 x 위치를 조정할 수 있는지 알고 싶습니다.다른 div에 따라 y 위치가 고정되어 있지만 x 위치는 고정되어 있지 않습니다.

HTML :

<div id="sidebar"> 
</div> 

CSS : 기사 내부

div#sidebar{ 
    width: 200px; 
    height: 100%; 
    position: fixed; 
    margin-top: 50px; 
    float: left; 
} 
+0

"* X 위치 *"는 무엇입니까 ..? 어떻게 당신이 * 적응 * 그것을 원하십니까 ..? –

답변

0

방법에 대한 설정 사이드 바?

jsfiddle

HTML :

<div id="article">article 
    <div id="sidebar">sidevar 
    </div> 
</div> 

CSS :

#article 
{ 
    margin-left: 30px; 
    background: white; 
    width: 200px; 
    height: 300px; 

} 

#sidebar 
{ 
    position: fixed; 

    top: 0px; 
    width: 30px; 
    height: 100%; 
    background: blue; 
    color: white; 
} 
관련 문제