Comment créer : tableau de tarifs réactif

Apprendre à utiliser CSS pour créer un tableau de tarifs réactif.

  • Basic
  • 9,99 $ / annee
  • 10 Go de stockage
  • 10 emails
  • 10 domaines
  • 1 Go de bande passante
  • S'inscrire
  • Pro
  • 24,99 $ / annee
  • 25 Go de stockage
  • 25 emails
  • 25 domaines
  • 2 Go de bande passante
  • S'inscrire
  • Premium
  • 49,99 $ / annee
  • 50 Go de stockage
  • 50 emails
  • 50 domaines
  • 5 Go de bande passante
  • S'inscrire

Essayez-le vous-même

Comment créer un tableau de tarifs réactif

Étape 1 - Ajouter HTML :

<div class="columns">
  <ul class="price">
    <li class="header">Basic</li>
    <li class="grey">9,99 $ / annee</li>
    
  • 10GB Storage
  • 10 Emails
  • 10 Domains
  • 1GB Bandwidth
  • Sign Up
  • 第二步 - 添加 CSS:

    * {
      box-sizing: border-box;
    }
    /* 创建三个等宽的列 */
    .columns {
      float: left;
      width: 33.3%;
      padding: 8px;
    }
    /* 设置列表的样式 */
    .price {
      list-style-type: none;
      border: 1px solid #eee;
      margin: 0;
      padding: 0;
      -webkit-transition: 0.3s;
      transition: 0.3s;
    }
    /* 鼠标悬停时添加阴影 */
    .price:hover {
      box-shadow: 0 8px 12px 0 rgba(0,0,0,0.2)
    }
    /* 定价表头 */
    .price .header {
      background-color: #111;
      color: white;
      font-size: 25px;
    }
    /* 列表项  */
    .price li {
      border-bottom: 1px solid #eee;
      padding: 20px;
      text-align: center;
    }
    /* 色列表项 */
    .price .grey {
      background-color: #eee;
      font-size: 20px;
    }
    /* "Sign Up" 按钮 */
    .button {
      background-color: #04AA6D;
      border: none;
      color: white;
      padding: 10px 25px;
      text-align: center;
      text-decoration: none;
      font-size: 18px;
    }
    /* 当屏幕宽度小于 600px 时,将三列的宽度更改为 100%(以便在小屏幕上堆叠) */
    @media only screen and (max-width: 600px) {
      .columns {
        width: 100%;
      }
    }
    

    Essayez-le vous-même