2012-04-10 5 views
0

다음과 같은 내용이 있습니다. html. 내 css 파일링크 속성 변경 중

<ol class="otherstufflinks"> 
    <li> 
     <a href="./pythonNotes/index.html">Python notes</a> 
    </li> 
    <li> 
     <a href="./figure.html">Cool figure made using</a> 
     <a href="http://mbostock.github.com/d3/" class="nestedlink">d3.js library.</a> 
    </li>    
</ol> 

관련 부분은 다음과 같습니다

나는 다른 색상을 선택합니다
a:link, a:visited { 
    color: steelblue; 
    text-decoration: none; 
} 

a:hover { 
    color: rgb(210,135,60); 
} 

.otherstufflinks > li, 
.otherstufflinks a:link, .otherstufflinks a:visited 
{ 
    font-weight: normal; 
    color: rgb(75,75,75); 
} 

.otherstufflinks a:hover { 
    color: rgb(210,135,60) 
} 

는, 클래스 nestedlink와 링크, 빨간색 말한다. 누군가가 나에게 그걸하는 법을 말해 줄 수 있다면 고맙겠습니다. 나는 다음을 시도했다. 그러나 그들 중의 누구도 일하지 않는다.

첫 번째 시도 :

.nestedlink a:link, .nestedlink a:visited { 
    color: red; 
} 

두 번째 시도 : 내가 잘못 가고 어디

.otherstufflinks .nestedlink a:link, .otherstufflinks .nestedlink a:visited { 
     color: red; 
    } 

표시되지 않습니다. 당신의 도움을 주셔서 감사합니다.

답변

5
a.nestedink:link, a.nestedlink:visited { 
color: red; 
} 

.nestedlink를 사용하는 경우에만 기본 a : link 속성이 .nestedlink를 덮어 씁니다.

+0

Jake와 Kasapo에게 감사드립니다. 그렇다면'.otherstufflinks a : link'의 경우 왜 작동합니까? BTW 당신의 대답은 훌륭했습니다. 감사. 그래서 받아 들일 수 있기 전에 7 분을 기다려야한다고 말했습니다. – Curious2learn

2

그냥 확실히

a.nestedlink:visited, a.nestedlink:visited { 
    color: red; 
} 

를 시도?

+0

이것은 다른 선택자를 재정의 할만큼 구체적이지 않습니다. – BoltClock

+0

이것은 작동하지 않았습니다. – Curious2learn

1

귀하의 CSS는 나쁜 시도 :

이 의미
a.nestedlink { color: red; } 

는 "클래스 nestedLink와 'A'(앵커) 타입의 요소에 적용". 당신이 가진 의미는 "클래스 중첩 링크가있는 요소의 하위 클래스 인 모든 앵커에 적용"

+0

이것은 작동하지 않았습니다. 색깔이 빨간색으로 바뀌지 않았습니다. – Curious2learn

+0

링크가 대문자로되어 있고 제외되어서는 안되는 점을 제외하고는 ... –

+0

아니요. 복사하고 붙여 넣지 않았습니다. 나는'nestedlink'를 올바르게 타이핑했다. 여전히 효과가 없었습니다. – Curious2learn