css实现带有阴影效果的图文卡片点击展开更多详情效果代码

代码语言:html

所属分类:布局界面

代码描述:css实现带有阴影效果的图文卡片点击展开更多详情效果代码

代码标签: css 图文 卡片 阴影

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">





    <style>
        @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");
        *,
        *::before,
        *::after {
          box-sizing: border-box;
        }
        
        .main {
          max-width: 1200px;
          margin: 0 auto;
          font-family: "Poppins", sans-serif;
        }
        .main .cards {
          display: flex;
          flex-wrap: wrap;
          list-style: none;
          margin: 0;
          padding: 0;
        }
        .main .cards_item {
          display: flex;
          padding: 1rem;
        }
        .main .cards_item .card {
          background-color: white;
          border-radius: 0.5rem;
          box-shadow: 0 20px 40px -14px rgba(0, 0, 0, 0.25);
          display: flex;
          flex-direction: column;
          overflow: hidden;
          position: relative;
          height: fit-content;
          padding: 0 0 2rem 0;
          position: relative;
        }
        .main .cards_item .card.truncate .card_text {
          overflow: hidden;
          max-height: 8rem;
          -webkit-box-orient: vertical;
          display: block;
          display: -webkit-box;
          overflow: hidden !important;
          text-overflow: ellipsis;
          -webkit-line-clamp: 4;
        }
        .main .cards_item .card.truncate .more {
          transform: rotate(180deg);
        }
        .main .cards_item .card .card_image {
          max-height: 250px;
        }
        .main .cards_item .card .card_content {
          padding: 1rem;
        }
        .main .cards_item .card .card_content .card_title {
          margin: 0.5rem 0;
        }
        .main .cards_item .card .card_content .card_text {
          margin: 0;
        }
        .main .cards_item .card .card_content .card_text .note {
          position: absolute;
          top: 1rem;
          right: 1rem;
          background: #ffffff95;
          font-weight: 600;
          border-radius: 0.1rem;
          padding: 0.1rem 0.5rem;
          text-transform: uppercase;
        }
        .main .cards_item .card .more {
          cursor: pointer;
          position: absolute;
          bottom: 0.25rem;
          display: flex;
          width: 100%;
          align-items: center;
          justify-content: center;
          text-align: center;
        }
        .main .cards_item .card .more:hover {
          color: #555;
        }
        
        .md {
          font-weight: 500;
        }
        
        @media (min-width: 40rem) {
          .cards_item {
            width: 50%;
          }
        }
        @media (min-width: 56rem) {
          .cards_item {
            width: 33.3333%;
          }
        }
        .material-icons {
          font-family: "Material Icons";
          font-weight: normal;
          font-style: normal;
          font-size: 1..........完整代码请登录后点击上方下载按钮下载查看

网友评论0