2014-01-29 1 views
-1

문제가 생겼습니다. CSS를 처음 접했을 때 어떻게해야합니까?div를 다른 CSS 위에 위치 시키십시오.

#left_box 
{ 
margin-top: 0px; 
min-width: 10%; 
max-width: 10%; 
height: 800px; 
background: #C90; 
border: thin 5px #33CCFF; 
position: absolute; 
z-index:1; 
left: 16px; 
top: 1px; 
float:none; 
} 

#bar_outside 
{ 

margin-top:75px; 
min-width:10px; 
max-width:2000px; 
height:55px; 
background:#ff69b4; 
border:#ff69b4: 5px; 
position:static; 
z-index:2; 

} 당신의 도움에 대한

I want the pink box to go over the orange box

감사 : 이것은 내 코드입니다!

+0

'position : static; to'position : relative;'z-index는 정적 위치 요소를 적용 할 수 없습니다. –

+0

'z-index'를 만들기 위해서는'position : relative/absolute/fixed'를 사용해야합니다. – Vucko

+4

http://jsfiddle.net/6RLqz/ 그런가요? – CRABOLO

답변

0

위치가 필요하지 않습니다. 절대적입니다. 왼쪽으로 플로트하고 너비를 정의

3

한 div가 위에 오도록하려면 #bar_outside에서 position: staticposition:relative으로 변경하면됩니다. z- 색인 속성은 상대, 절대 또는 고정으로 작동하기 때문입니다. See the fiddle.

div가 다른쪽에 배치되도록하려면 두 CSS 클래스 모두에서 float CSS 속성을 사용하십시오. See the fiddle.

관련 문제