어떻게 만드는가: 비교 테이블

CSS를 사용하여 비교 테이블을 만들어 보세요.

Features Basic Pro
Sample text
Sample text
Sample text
Sample text
Sample text

직접 테스트해 보세요

비교 테이블을 어떻게 만드는가

第一步 - HTML 추가:

<!-- Font Awesome 아이콘 라이브러리 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<table>
  <tr>
    <th style="width:50%">Features</th>
    <th>Basic</th>
    <th>Pro</th>
  </tr>
  <tr>
    <td>Sample text</td>
    <td><i class="fa fa-remove"></i></td>
    <td><i class="fa fa-check"></i></td>
  </tr>
  <tr>
    <td>Sample text</td>
    <td><i class="fa fa-check"></i></td>
    <td><i class="fa fa-check"></i></td>
  </tr>
</table>

第二步 - CSS 추가:

/* 테이블 스타일 설정 */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  border: 1px solid #ddd;
{}
/* 테이블 헤더와 데이터 스타일 설정 */
th, td {
  text-align: center;
  padding: 16px;
{}
th:first-child, td:first-child {
  text-align: left;
{}
/* 점무지 테이블 행 */
tr:nth-child(even) {
  background-color: #f2f2f2;
{}
.fa-check {
  color: green;
{}
.fa-remove {
  color: red;
{}

직접 테스트해 보세요