模板:首页2023/styles.css

来自戏曲百科
/* ==============================
   卡片外部容器样式
   ============================== */

.cards-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between; 
}

/* ==============================
   单张卡片样式
   ============================== */

.首页卡片-container {
  border: 1px solid #ccc;
  padding: 10px;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
  overflow: hidden;
  width: calc(50% - 10px);
  margin: 10px 0;  
  box-sizing: border-box; 
}

.首页卡片-image {
  float: left;
  margin: 10px 10px 10px 0;
  width: 100px;
  height: 100px;
  position: relative;
  overflow: hidden;
}

.首页卡片-image img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 保证图像以封面方式填充其容器 */
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.首页卡片-desc {
  font-size: 14px;
  overflow: hidden;
  position: relative;
  max-height: calc(5 * 1.5em);
  line-height: 1.5em;
  padding-bottom: 1em;
}

.首页卡片-desc:after {
  content: '';            
  position: absolute;     
  bottom: 0;              
  right: 0;
  width: 100%;            
  height: 1.5em;          
  background: linear-gradient(to top, white, transparent);
}

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

/* ==============================
   手机端样式调整
   ============================== */

@media only screen and (max-width: 600px) {
  .首页卡片-container {
    width: 100%;  
    margin: 10px 0;  
  }
  .首页卡片-desc {
    max-width: calc(100% - 120px); 
  }
}