2010-07-12 3 views
0

내 HTML 마크 업부모 요소가 아닌 중앙에

<div id="main-wrapper"> 

      <div id="header-wrapper"> 
       <div id="header"> 
            </div><!--end of #header --> 
       <div class="clear"></div> 
      </div><!--end of #header-wrapper --> 

      <div id="content-wrapper"><!-- this is closed in footer.php --> <!-- main image with its map --> 
    <img usemap="#homemap" class="map" src="http://rtcamp.com/wp-content/themes/rtcamp-new/img/home-main.png"> 

      <div class="clear"></div> <!--clear any float present at this point --> 
     </div><!-- End of #content-wrapper --> 

     <div id="footer-wrapper"> 

     </div><!--End of #footer-wrapper-->   
    </div> 

사용 CSS 파이어 폭스 등 모든 브라우저에서

body.view-home #main-wrapper { 
height:100%; 
} 

#main-wrapper { 
margin:0 auto; 
width:960px; 


} 

body.view-home #header-wrapper { 
height:auto !important; 
margin:0 auto -555px; 
min-height:100%; 
} 


body.view-home #content-wrapper { 
display:block; 
height:555px; 
margin:0 auto; 
overflow:hidden; 
position:relative; 
width:980px; 
} 

의 메인 래퍼 사업부는 메인 래퍼 브라우저하지만 IE7의 중심을 표시 크롬 센터에 나타나지 않습니다. 브라우저의 왼쪽에 나타납니다.

도와주세요.

답변

1

이러한 스타일을 시도해보십시오

body { 
    text-align:center; 
} 

#main-wrapper { 
    margin:0 auto; 
    width:960px; 
    text-align:left; 
} 
+0

골목 이봐, 덕분에 그 작업 : 당신에게 – Soarabh

+0

@saorabh 감사 : 당신은 환영합니다 .... – Sarfraz

+1

설명 :'마진 : 0 auto' 실제 중심을한다 . 그러나 IE가 이것을 지원하지 않으므로, 중심에있는 div의 부모에게 'text-align : center' 속성을 부여해야합니다. 그러나 이제는 div가 중심에 놓이게 될뿐만 아니라 그 안에있는 텍스트가 있으므로,'text-align : left'를 사용하여이 동작을 재설정해야합니다. – NikiC

관련 문제