2013-06-03 3 views
1

전체 화면 CSS 레이아웃을 만들고 싶습니다.전체 화면 CSS 레이아웃

<div id="divLeft">LEFT is ok</div> 
<div id="divRight"> 
    <div id="divTop">TOP is ok</div> 
    <div id="divCenter">CENTER should have liquid height</div> 
    <div id="divBottom">BOTTOM should be always bottom</div> 
</div> 

CSS

html{ 
    height:100% 
} 
body{ 
    height:100% 
} 
#divLeft{ 
    float:left; 
    width:70px; 
    height:100%; 
    background:#6c9; 
} 
#divRight{ 
    margin-left:70px; 
    height:100%; 
    background:#999; 
    color:#fff; 
} 
#divTop{ 
    background:red; 
    text-align:right; 
} 
#divCenter{ 
     background:blue; 
     text-align:center; 
} 
#divBottom{ 
    background:green; 
    text-align:center; 
} 

Here is jsfiddle

그래서, 문제는 #divCenter (이 있어야 액체 높이) 및 #divBottom (화면 하단에 항상 있어야한다)으로한다.

+4

뭔가? http://jsfiddle.net/gpwD4/5/ – Adrift

+0

@SunSky는'position : absolute'와 최하위 0px로 시도합니다. http://jsfiddle.net/Bonaca/gpwD4/4/ .. 수다쟁이가 훨씬 더 좋습니다 :) – swapnesh

+0

@Adrift 좋은 일, 당신은 대답으로 게시해야합니다 :) – Praveen

답변

4

supported below IE 9이 아니지만 모바일 지원 기능이 상당히 좋지 않지만 calc() 기능을 사용하면 쉽게이를 수행 할 수 있습니다. 당신이해야 할 일은 #divCenter의 형제들로부터 높이의 100 %에서 20px + 20px 높이를 뺀 것입니다. 꼬리말에 바닥 글을 표시하려면 포함하는 블록을 상대적으로 배치 한 다음 바닥 글을 절대적으로 배치하고 하단에 배치해야합니다 (bottom: 0;).

http://jsfiddle.net/gpwD4/6/

3

#divTop#divBottom가 고정 된 것을 높이를 가정하면,이 작업을 수행 할 수 있습니다 :이 같은

#divRight{ 
    position: relative; 
} 

#divCenter{ 
    position: absolute; 
    top: (height of #divTop) 
    bottom: (height of #divBottom) 
    left:0; 
    right:0; 

} 
#divBottom{ 
    position: absolute; 
    left:0; 
    bottom:0; 
    right:0; 
} 

LIVE DEMO

+0

해결되었습니다. 고마워. – bonaca

관련 문제