소스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | <!DOCTYPE html> <html> <head> <meta> <style> table{ width: 100%; } tr:first-child{ background-color: darkgray; } tr:nth-child(2n){ /*짝수*/ background-color: beige; } tr>th:nth-child(1){ width: 10%; } tr>th:nth-child(2){ width: 60%; } tr>th:nth-child(3){ width: 20%; } td>a{ display: inline-block; width: 100%; text-decoration: none; color: black; } .line:hover{ background-color: darksalmon; } </style> </head> <body> <table> <tr> <th>1열</th> <th>2열</th> <th>3열</th> <th>4열</th> </tr> <tr class="line"> <td><a href="#">1줄</a></td> <td><a href="#">1</a></td> <td><a href="#">2</a></td> <td><a href="#">3</a></td> </tr> <tr class="line"> <td>2줄</td> <td>1</td> <td>2</td> <td>3</td> </tr> <tr class="line"> <td>3줄</td> <td>1</td> <td>2</td> <td>3</td> </tr> <tr class="line"> <td>4줄</td> <td>1</td> <td>2</td> <td>3</td> </tr> <tr class="line"> <td>5줄</td> <td>1</td> <td>2</td> <td>3</td> </tr> <tr class="line"> <td>6줄</td> <td>1</td> <td>2</td> <td>3</td> </tr> <tr class="line"> <td>7줄</td> <td>1</td> <td>2</td> <td>3</td> </tr> <tr class="line"> <td>8줄</td> <td>1</td> <td>2</td> <td>3</td> </tr> <tr class="line"> <td>9줄</td> <td>1</td> <td>2</td> <td>3</td> </tr> </table> </body> </html> | cs |
결과
마우스를 올리고 있는 경우
'* Programming > HTML&CSS' 카테고리의 다른 글
[HTML/CSS] 숨김기능&선택지시자 (+와 ~의 차이) (0) | 2016.09.26 |
---|---|
[HTML/CSS] 상단 이미지 고정하기 (0) | 2016.09.22 |
[HTML/CSS] 지시자 우선순위 (0) | 2016.09.22 |
[HTML/CSS] 이미지 넣기 (0) | 2016.09.22 |
[HTML/CSS] 마진과 패딩,border(color,style,width) (0) | 2016.09.22 |