2012-12-10 4 views
0

이 html 코드가 있습니다.이 버튼은 이제이 두 버튼에 다른 CSS를 제공해야합니다.버튼에 대한 CSS 속성

도와 주실 수 있습니까?

<div class="modal" style="display: none;"> 
<button type="button" class="action confirm">Konfirmo</button> 
<button type="button" class="action cancel">Anullo</button> 
</div> 

내가 그 두 개의 버튼에 다른 CSS를 제공하기 위해 노력하고 .modal .button .confirm 과 같이해야한다. 그래서, 어떻게 할 수 있어요! 감사합니다 ..

+0

내가 당신을 이해하지 못했다, 그래서 뭔가를해야만 같은 것와 두 번째 : .modal 버튼 확인을 {}? –

+0

당신은 .cancel {...}를'클래스 '.modal {...} .button {...} .confirm을 separatley이 세 가지 (또는 그 이상) 선언 {...} 수 그래서 당신은 할 수 요즘 결합하면 CSS 재사용이 가능합니다. –

답변

0
div.modal button.confirm{ 
    /* css for confirm buttom */ 
} 

div.modal button.cancel{ 
    /* css for cancel buttom */ 
} 
+0

고마워요. 그것은 꽤 잘 작동했는데, 조금 후에 대답을 받아들입니다! 감사합니다 –

+0

당신은 아마 선택기에서'div'을하지 않아도됩니다. –

2

나는 당신이 묻는 것에 대해 명확하지 않지만, 이와 비슷한 것을 찾고 있습니까?

.modal .confirm { 
    color: green; 
} 

.modal .cancel { 
    color: red; 
} 
1

스타일 첫 번째 .modal button.confirm { ... }와 버튼을 .modal button.cancel { ... }

관련 문제