css实现自适应表格卡片筛选效果代码

代码语言:html

所属分类:表格

代码描述:css实现自适应表格卡片筛选效果代码

代码标签: css 自适应 表格 卡片 筛选

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i" rel="stylesheet">



    <style>
        .modules__container {
          position: relative;
          margin: 0 auto;
          max-width: 1080px;
        }
        
        .info__header {
          font-weight: normal;
          position: absolute;
          overflow: hidden;
          clip: rect(0 0 0 0);
          height: 1px;
          width: 1px;
          margin: -1px;
          padding: 0;
          border: 0;
        }
        
        .modules__info {
          width: 100%;
        }
        
        .info__module {
          display: flex;
          flex-direction: column;
          box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
          margin: 1em;
          max-height: 500px;
          transition-property: opacity, transform;
          transition-duration: 0.225s;
          transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
        }
        
        .info__module--hide {
          transform: scale(0);
          margin: 0 1em !important;
          max-height: 0;
          opacity: 0;
        }
        
        .modules__nav {
          margin: 0 1em;
          display: flex;
          flex-wrap: wrap;
          justify-content: center;
          align-items: center;
          align-content: space-around;
        }
        
        .nav__button {
          color: white;
          border: 0;
          height: 3em;
          font-size: 1em;
          text-align: center;
          transition: all 0.225s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        .nav__button:focus {
          outline: 0;
          background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.2) 100%);
        }
        
        .nav__button--selected {
          transform: scale(1.2);
          margin: 0.5em;
          transition-duration: 0.195s;
        }
        
        .nav__button--plain {
          background: #555;
        }
        
        /* START of td styling */
        .module__color {
          margin-bottom: 0.5em;
          width: 100%;
          height: 0.5em;
        }
        
        .color__shape {
          height: 100%;
        }
        
        .module__code {
          font-size: 1.5em;
        }
        
        .module__title {
          font-style: italic;
        }
        
        .module__code,
        .module__credit,
        .module__title,
        .module__exam {
          padding: 0 1rem;
        }
        
        .module__credit,
        .module__action {
          margin-top: 0.5em;
        }
        
        .module__credit::after {
          font-size: 1em;
          content: " credits";
        }
        
        .module__exam::before {
          font-size: 1em;
          content: "Exam on: ";
        }
        
        .module__exam {
          border-bottom: 1px solid #ddd;
        }
        
        .module__action {
          display: flex;
          margin: 0;
          height: 3em;
        }
        
        .action__button {
          background: transparent;
          border: 0;
          padding: 0;
          flex: 1 0 auto;
        }
        
        .action__button:hover {
          background: rgba(0, 0, 0, 0.1);
          cursor: pointer;
        }
        
        /* END of td styling */
        /* Start of media query */
        @media (min-width: 900px) {
          .modules__info {
            text-align: left;
            table-layout: fixed;
            border-collapse: collapse;
          }
        
          .info__header {
            height: 3em;
            background: #ddd;
            position: static;
            overflow: inherit;
            clip: inherit;
            width: auto;
            margin: 0;
          }
        
          .info__module {
            height: 3em;
            display: table-row;
          }
        
          .info__module--hide {
            margin: 1em;
            transform: scale(1);
            max-height: inherit;
            visibility: visible;
            opacity: 1;
          }
        
          .header__color {
            width: 5%;
          }
        
          .header__code {
            width: 7.5%;
          }
        
          .header__title {
            width: 40%;
          }
        
          .header__credit {
            width: 7.5%;
          }
        
          .header__exam {
            width: 15%;
          }
        
          .header__action {
            width: 15%;
          }
        
          .modules__nav {
            display: none;
          }
        
          /* START of td styling */
          .color__shape {
            margin: 0 auto;
            height: 1em;
            width: 1em;
            border-radius: 0.5em;
          }
        
          .module__code {
            font-size: 1em;
          }
        
          .module__title,
        .module__exam,
        .module__code,
        .module__credit {
            padding: 0 1em 0 0;
          }
        
          .module__exam {
            border: 0;
          }
        
          .module__action {
            justify-content: center;
          }
        
          .action__button {
            flex: 0 0 30%;
          }
        
          .module__credit::after {
            content: "";
          }
        
          .module__exam::before {
            content: "";
          }
        
          /* END of td styling */
        }
        body {
          font: 400 16px/1.4;
          font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
          background: #f2f2f2;
          color: #333;
        }
        
        input,
        button {
          font-family: inherit;
        }
        
        .module__1 {
          background: #42A5F5;
        }
        
        .module__2 {
          background: #4CAF50;
        }
        
        .module__3 {
          background: #FBC02D;
        }
        
        .module__4 {
          background: #e74c3c;
        }
        
        .module__5 {
          background: #FB8C00;
        }
        
        .module__6 {
          background: #BA68C8;
        }
        
        .module__7 {
          background: #80CBC4;
        }
        
        .module__8 {
          background: #BDBDBD;
        }
        
        .module__9 {
          background: #90A4AE;
        }
        
        ul,
        ol,
        td {
          padding: 0;
          margin: 0;
          list-style: none;
        }
        
        th {
          font-weight: normal;
        }
        
        .hidden {
          display: none;
        }
        
        svg {
          height: 1.5rem;
          width: 1.5rem;
        }
    </style>



</head>

<body>
    <h1 style="text-align: center; width: 100%;">Table to Cards</h1>
    <h2 style="text-align: center; width: 100%;">&larr; Drag the viewport &rarr;</h2>
    <section class="modules">
        <div class="modules__container">
            <table class="modules__info">
                <thead>
                    <tr class="info__header">
                        <th class="header__color"></th>
                        <th class="header__code">Code</th>
                        <th class="header__title">Title</th>
                        <th class="header__credit">Credits</th>
                        <th class="header__exam">Exam Timing</th>
                        <th class="header__action"></th>
                    </tr>
                </thead>
                <tbody>
                    <tr class="info__module">
                        <td class="module__color">
                            <div class="color__shape module__1"></div>
                        </td>
                        <td class="module__code">CFG1010</td>
                        <td class="module__title">The Evolution of a Global City-State</td>
                        <td class="module__credit">4</td>
                        <td class="module__exam">25-04-2016 5:00 PM</td>
                        <td class="module__action">
                            <button class="action__button">
              <svg>
              <use xlink:href="#delete"/>
              </svg>
            </button>
                            <button class="action__button">
              <svg>
                <use xlink:href="#visible"/>
              </svg>
            </button>
                            <button class="action__button">
              <svg>
                <use xlink:href="#info"/>
              </svg>
            </button>
                        </td>
                    </tr>
                    <tr class="info__module">
                        <td class="module__color">
                            <div class="color__shape module__2"></div>
                        </td>
                        <td class="module__code">CS1010</td>
                        <td class=".........完整代码请登录后点击上方下载按钮下载查看

网友评论0