2013-08-01 3 views
2

기사 속성을 변경하고 싶지만 섹션 속성을 설정해도 작동하지 않는 것 같습니다. 예를 들어 :섹션 내부의 기사 속성을 변경할 수 없습니다.

<html> 
<style type="text/css"> 

section{ 
    margin:2px auto; 
    background-color:green; 
    border:2px solid blue; 
    width:500px; 
    height:10em; 
}; 
/* will not work for article*/ 
article{   
    padding:auto; 
    margin:2px auto; 
    background-color:red; 
    border:2px dashed red; 
    width:100px; 
    height:2em; 
} 
</style> 
<body> 
<section> 
    <article>hello</article> 
    <article>hello</article> 
    <article>hello</article> 
</section> 
</body> 
</html> 

하지만 이후 섹션에 대한 CSS 코드를 제거, 그것은 작동합니다

<html> 
<style type="text/css"> 
/*works now*/ 
article{ 
    margin:2px auto; 
    background-color:red; 
    border:2px dashed red; 
    width:100px; 
    height:2em; 
} 
</style> 
<body> 
<section> 
    <article>hello</article> 
    <article>hello</article> 
    <article>hello</article> 
</section> 

</body> 
</html> 

내가

답변

2

28. 당신은 이 그것을 firefox22 크롬에 검사를; 섹션 {} 이후에는 CSS가 유효하지 않으므로 다음 문을 위반합니다.

CSS 선언에서 제거하고 문제가 해결되었는지 알려주십시오.

<style type="text/css"> 

section{ 
    margin:2px auto; 
    background-color:green; 
    border:2px solid blue; 
    width:500px; 
    height:10em; 
} /* ; <-- remove it */ 


article{   
    padding:auto; 
    margin:2px auto; 
    background-color:red; 
    border:2px dashed red; 
    width:100px; 
    height:2em; 
} 
</style> 
+0

나는 그것을 좋아한다. –

관련 문제