2009-08-18 6 views
2

아래 div에 2 개의 CSS 코드가 있습니다. 첫 번째 페이지에는 div가 없거나 그 위에 아무런 이름이 없습니다. 나는 또한 무엇이라도 그것을 개명 할 수있다.내가 본 이상한 CSS 문제

이제 이상한 부분이 들어옵니다. 아래 코드의 두 번째 비트는 너비가 520px입니다. 페이지의 div가 520px가되는 유일한 방법은 위의 CSS 코드를 그대로두면됩니다. 하나는 페이지에 존재 div없이 작동하는 두 번째 CSS 코드에 대한 페이지에 있어야했다, 처음에는 내가 브라우저 캐싱 문제가되어야한다고 생각했기 때문에 캐시를 지우고 아무 것도하지 않고 다음 두 가지를 시도했다. 브라우저는 모두 동일한 결과를 얻습니다.

페이지의 첫 번째 비트를 추가하고 두 번째 비트가 작동하면 첫 번째 비트를 제거하고 두 번째 비트는 작동하지 않습니다. 여기에 뭔가가 내려다 보이니?

.commentwrappsdfsde2{width:950px;margin:0 0;padding:0;} 

.commentwrapper{width:520px;margin-right:auto;margin-left:auto;} 

여기에 전체 페이지 코드

<style> 
<!-- css for user photos--> 
div.imageSub img.female { border-top: 1px solid #FF3399; } 
div.imageSub img.male { border-top: 1px solid #3399FF; } 
div.imageSub img { z-index: 1; margin: 0; display: block; } 
div.imageSub div { 
    position: relative; 
    margin: -15px 0 0; 
    padding: 5px; 
    height: 5px; 
    line-height: 4px; 
    text-align: center; 
    overflow: hidden; 
font-family:Trebuchet MS,Helvetica,sans-serif; 
font-size:12px; 
font-weight: bold; 
} 
div.imageSub div.blackbg { 
    z-index: 2; 
    background-color: #000; 
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; 
    filter: alpha(opacity=70); 
    opacity: 0.5; 
} 
div.imageSub div.label { 
    z-index: 3; 
    color: white; 
} 
<!-- end photo block--> 
/* Comments */ 
.commentwrappsdfsde2{width:950px;margin:0 0;padding:0;} 
.commentwrapper{width:520px;margin-right:auto;margin-left:auto;} 
#comments ol.commentlist li { list-style-type:none; padding:20px; background:none; } 
#comments ol.commentlist li.thread-even { background:#f6f6f6; border-top:1px solid #e3e3e3; border-bottom:1px solid #e3e3e3; } 

#comments ul.children li ul.children,#comments .commentlist{padding:0;} 
</style> 

<div class="commentwrapper"> 
<div id="comments"> 
    <ol class="commentlist"> 
    <li class="comment thread-even " > 
    Comment 1 
    </li> 
    </ol> 
</div> 
</div> 
+0

여백 : 0 0 일 수 있습니까? 첫 번째 CSS 클래스의 비트? 그 재산을 제거하면 어떻게됩니까? – Kirtan

+0

이 (가) – JasonDavis

+0

인 것 같지 않습니다. FF 3.5에서 재현 할 수 없습니다. – balpha

답변

11

그 첫 번째는, 즉 형식이 잘못되었습니다 직전 CSS 누락 닫는 브래킷과 같은 잘못된 구문을 가지고 내가 추측 벤처 것에게 있습니다. 이 경우 문은 다음 유효한 닫는 대괄호까지 건너 뛸 수 있습니다. 말도 안되는 문장은 구문을 "수정"하므로 .commentwrapper 문장을 건너 뛰면됩니다.

+0

나는 당신이 옳다고 생각합니다. 고마워요. – JasonDavis