a

날나리 강좌. ㅋ 레이아웃 짜기, 완성 예제

· 14년 전 · 1933
김군 왈, " 허허허.. 드디어 다 되었도다... "

A군 왈, " 어? 뭐가 ? "

김군 왈, " 레이아웃 짜는 것이 모두 끝났다고... "

A군 왈, " 마무리는 왜 니가 짓노? 하는 것은 다 내가 한 것 같은데... "

김군 왈, " 어허.. 마지막이니 멋진 김군은 이제 빠빠 잖아... "

A군 왈, " 가끔은.. 왜 A양, B양, O양 설정하지 않고 김군으로 했는지... 했는데..  정도 들었고 그간 고생했다. "

김군 왈, " 근데... 이니셜이 무슨 모양 모양 비디오 같은데서 들어 본 것 같은데? "

A군 왈, " 허허.. 역시 눈치 빠른 김군... 내가 못 당해..  "

김군 왈, " 이제 마지막이니.. 그동안 한 것을... 총 복습으로 마무리 완성품을 만들어 볼께... "

A군 왈, " 그래.. 그래.. 화이팅 "

<!doctype html>
<head>
<title> aequum's layout </title>
<style>
html, body {height: 100%}
body {font:14px/1.5 georgia}
html, body, div, p, form, img { margin:0;padding:0; border:0;}

#wrapper {
    position: relative;
    z-index: 5;
    background:url('bg.png') repeat-y ;
}

div.setWidth {
    width: 960px;
}

body.setAlign #wrapper,
body.setAlign #ADBlockItems,
body.setAlign.left #wrapper,
body.setAlign.left  #ADBlockItems  {margin: 0 auto 0 0;}

body.setAlign.center #wrapper,
body.setAlign.center #ADBlockItems {margin:0 auto;}

body.setAlign.right #wrapper,
body.setAlign.right #ADBlockItems  {margin: 0 0 0 auto;}

#header    {height:100px; background:#fff; border:1px solid #EFEFEF; }
#container {position:relative; overflow:hidden; zoom:1;}
#footer    {height:150px; background:#fff; border:1px solid #EFEFEF;}

#container #leftSidebar {
    float:left; width:240px; padding:10px;
    display: inline;
}
#container #content {float:left; width: 480px; padding:10px;}
#container #rightSidebar {float:left; width: 180px; padding:10px;}

#ADBlock   {
    position:absolute;width:100%;height:100px;
    left:0;top:100px;

    overflow:hidden
}
#ADBlockItems {
    position:relative;
    margin:0 auto;
}
#ADBlock div.AD {
    position:absolute;width:100px;
    background:#E7E7E7;
    height:100px;
}
#ADBlock div.AD.left  {left:-100px;}
#ADBlock div.AD.right {left:960px;} 

#wrapper.fixedFooter {
    min-height:100%; height:auto !important; height:100%;
}
#wrapper.fixedFooter #container {padding-bottom:152px;}
#wrapper.fixedFooter #footer    {
    position:absolute;
    bottom:0;width:100%
}
</style>
</head>
<body class="setAlign center">

<div id="wrapper" class="setWidth fixedFooter">

    <!-- #header -->
    <div id="header">
        #Header
    </div>

    <!-- #main -->
    <div id="container">
        <div id="leftSidebar">
            #leftStdebar 
        </div>
        <div id="content">
            #content
        </div>
        <div id="rightSidebar">
            #rightSidebar
        </div>
    </div>

    <!-- #footer -->
    <div id="footer">
       #footer
    </div>

</div>

<!-- #ADBlock -->
<div id="ADBlock">
    <div id="ADBlockItems" class="setWidth">
        <div class="AD left"> .AD.left </div>
        <div class="AD right"> .AD .right </div>
    </div>
</div>

</body>
</html>


A군 왈, " 그동안 가르친 보람이 있는데...  어떻게 작성했는지 설명해봐 "

김군 왈, " 나름 재활용 가능하게... 코드를 나름 다소 구조적(?)인 작성을 헀어.

정렬기능이 있어.<body>클래스에 "setAlign"과 함께 center 등이 사용되면 그에따라 정렬되게 하였고.... 
또 문서 폭은 한 번에  div.setWidth를 수정해주면 그에 맞게 차지하게 했어. wrapping 했기에 그안에 header, container, footer 같은 요소의 폭은 따로 정해줄 필요가 없고... height는 각각 맞게 고치면 돼. width 변경으로 container 내부 float된 것은 물런 다시 계산해서 설정해야할 것이고..  

게다가... 나름 광고 영역은 따로 분리해서 넣거나 빼는 등 쉽게 따로 관리가능하게 했고...
#wrapper <div>요소에 "fixedFooter" 클래스를 사용여부에 따라 바닥에 footer가 붙게 하거나 마는 등도 결정할 수 있게 하였어. "

A군 왈, " 오... 나름 보람을 느끼네.. ㅎㅎㅎ 자 그럼 그동안에 버그 잡기와 함꼐 다루었던 주제가 어떻게 적용되었는지 살펴보자고...

  • #wrapper : 배경 이미지 사용 - faux column의 적용
  • #wrapper : position:relative - footer의 absolute로 좌표계 기준으로 사용
  • #wrapper : z-index:5 - 광고 블록보다 앞으로 위치 (구형 브라우저의 음의 z-index 처리 차이 [CSS 2.1수정된 부분])
  • #container : overflow:hidden 과 zoom:1 - clear:both 대신 사용, hasLayout 관련 부분
  • #wrapper.fixedFooter : ie6도 가능한 min-height 트릭
  • #container #leftSidebar : display:inline - IE6에서 더블 마진 버그 해결

예제에서 빠졌지만 
  • IE6에서 음의 마진시 짤림 현상과 해결
  • IE6에서 float된 요소들이 마진이 있는 경우 문제 (hasLayout 관련)
  • IE9를 포함한 IE의 배경 투명에 대한 독특한 처리 및 해결 방법
  • 동일 높이 column의 처리 : faux column 사용, javascript 방법, absolute의 사용
  • 등등....? 
이제 레이아웃은 걱정없이 앞으로 잘 짤 수 있을 것이얌... "

6683638669_635e8db75a_b.jpg

사용한 배경 파일은 위에...

---- 

ㅃㅃ

첨부파일

layoutExample.zip (1.6 KB) 78회 2012-01-12 19:30
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
14년 전 조회 1,912
14년 전 조회 1,065
14년 전 조회 911
14년 전 조회 964
14년 전 조회 626
14년 전 조회 1,275
14년 전 조회 1,155
14년 전 조회 627
14년 전 조회 1,001
14년 전 조회 4,070
14년 전 조회 1,093
14년 전 조회 2,804
14년 전 조회 1,023
14년 전 조회 1,066
14년 전 조회 855
14년 전 조회 639
14년 전 조회 1,664
14년 전 조회 669
14년 전 조회 624
14년 전 조회 939
14년 전 조회 750
14년 전 조회 1,002
14년 전 조회 773
14년 전 조회 1,815
14년 전 조회 2,279
14년 전 조회 1,129
14년 전 조회 1,107
14년 전 조회 840
14년 전 조회 2,859
14년 전 조회 885
14년 전 조회 601
14년 전 조회 1,415
14년 전 조회 1,815
14년 전 조회 786
14년 전 조회 1,342
14년 전 조회 1,361
14년 전 조회 1,428
14년 전 조회 1,518
14년 전 조회 1,173
14년 전 조회 8,700
14년 전 조회 1,300
14년 전 조회 1,574
14년 전 조회 735
14년 전 조회 679
14년 전 조회 796
14년 전 조회 1,144
14년 전 조회 2,188
14년 전 조회 712
14년 전 조회 1,721
14년 전 조회 1,934
14년 전 조회 1,080
14년 전 조회 1,005
14년 전 조회 587
14년 전 조회 1,165
14년 전 조회 1,073
14년 전 조회 941
14년 전 조회 838
14년 전 조회 902
14년 전 조회 1,253
14년 전 조회 2,035
14년 전 조회 1,149
14년 전 조회 613
14년 전 조회 9,978
14년 전 조회 930
14년 전 조회 801
14년 전 조회 1,380
14년 전 조회 2,499
14년 전 조회 1,308
14년 전 조회 999
14년 전 조회 778
14년 전 조회 1,689
14년 전 조회 967
14년 전 조회 2,352
14년 전 조회 772
14년 전 조회 783
14년 전 조회 900
14년 전 조회 1,539
14년 전 조회 778
14년 전 조회 2,267
14년 전 조회 615
14년 전 조회 3,183
14년 전 조회 3,341
14년 전 조회 3,254
14년 전 조회 3,065
14년 전 조회 766
14년 전 조회 723
14년 전 조회 1,216
14년 전 조회 1,482
14년 전 조회 674
14년 전 조회 762
14년 전 조회 674
14년 전 조회 4,756
14년 전 조회 648
14년 전 조회 5,032
14년 전 조회 1,343
14년 전 조회 1,143
14년 전 조회 618
14년 전 조회 801
14년 전 조회 1,320
14년 전 조회 780
🐛 버그신고