CSS 만 사용하여 테이블의 두 번째 열만 CSS를 재정의 할 수 있습니다.
다음을 사용하여 모든 열에 액세스 할 수 있습니다.
.countTable table table td
이 페이지가 내 사이트가 아니기 때문에 수정하기 위해이 페이지의 html에 액세스 할 수 없습니다.
감사.
답변
다음 :nth-child
과 같이 의사 클래스를 사용할 수 있습니다 .
.countTable table table td:nth-child(2)
하지만 이전 브라우저 (또는 IE)에서는 작동하지 않습니다.이 경우 셀에 클래스를 제공하거나 자바 스크립트를 사용해야합니다.
답변
이 시도:
.countTable table tr td:first-child + td
다른 열의 스타일을 지정하기 위해 반복 할 수도 있습니다.
.countTable table tr td:first-child + td + td {...} /* third column */
.countTable table tr td:first-child + td + td + td {...} /* fourth column */
.countTable table tr td:first-child + td + td + td +td {...} /* fifth column */
답변
테이블의 두 번째 열만 변경하려면 다음을 사용하십시오.
일반적인 경우 :
table td + td{ /* this will go to the 2nd column of a table directly */
background:red
}
너의 경우:
.countTable table table td + td{
background: red
}
참고 : 이것은 모든 브라우저 (최신 및 이전 브라우저)에서 작동하므로 이전 질문에 대한 답변을 추가했습니다.
답변
두 번째 열의 각 셀에 대해 클래스를 지정할 수 있습니다.
<table>
<tr><td>Column 1</td><td class="col2">Col 2</td></tr>
<tr><td>Column 1</td><td class="col2">Col 2</td></tr>
<tr><td>Column 1</td><td class="col2">Col 2</td></tr>
<tr><td>Column 1</td><td class="col2">Col 2</td></tr>
</table>
답변
이 웹 http://quirksmode.org/css/css2/columns.html에서 나는 쉬운 방법을 찾았습니다.
<table>
<col style="background-color: #6374AB; color: #ffffff" />
<col span="2" style="background-color: #07B133; color: #ffffff;" />
<tr>..