최근 게시물 CSS 스타일

<aside> 💡

padotax.com에 사용한 스타일이다.

추가 CSS에 붙여넣어 사용할 수 있다.

</aside>

/* 워드프레스 최근 게시물 (wp-block-latest-posts) */
/* 1. 게시글 목록(ul) 기본 설정 - 중앙 정렬 및 그리드 강제 적용 */
ul.wp-block-latest-posts.posting-contents {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  list-style: none !important;
  padding: 0 !important;
  display: grid !important; /* display 속성 강제 */
  grid-template-columns: repeat(
    auto-fit,
    minmax(300px, 1fr)
  ) !important; /* 그리드 너비 계산 강제 */
  gap: 30px;
}

/* 2. 개별 게시글 카드(li) 디자인 */
ul.wp-block-latest-posts.posting-contents li {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease-in-out;
  margin: 0;
  padding: 0;
  position: relative;
  padding-top: 200px;
  width: 100%; /* 너비를 100%로 명시 */
}

/* 3. 카드 호버 효과 */
ul.wp-block-latest-posts.posting-contents li:hover {
  transform: translateY(-8px);
  border-color: #3b82f6;
  box-shadow: 0 20px 60px rgba(59, 130, 246, 0.15);
}

/* 4. 썸네일 이미지 영역 (실제 이미지) */
.wp-block-latest-posts.posting-contents .wp-block-latest-posts__featured-image {
  position: absolute;
  top: 0;
  left: 0;
  height: 200px;
  width: 100%;
  overflow: hidden;
  background-color: #f3f4f6;
  margin: 0;
}

.wp-block-latest-posts.posting-contents
  .wp-block-latest-posts__featured-image
  a,
.wp-block-latest-posts.posting-contents
  .wp-block-latest-posts__featured-image
  img.wp-post-image {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important; /* 최소 너비도 100%로 보장 */
  max-width: 100% !important; /* 최대 너비도 100%로 보장 */
  object-fit: cover;
}

.wp-block-latest-posts.posting-contents
  li:hover
  .wp-block-latest-posts__featured-image
  img.wp-post-image {
  transform: scale(1.05);
}

/* 5. 자리 표시자(Placeholder) */
ul.wp-block-latest-posts.posting-contents li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 200px;
  background-color: #f3f4f6;
}

/* 6. 게시글 제목 */
ul.wp-block-latest-posts.posting-contents .wp-block-latest-posts__post-title {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  color: #1a1a1a !important;
  text-decoration: none !important;
  line-height: 1.5 !important;
  padding: 0 30px;
  margin-top: 24px;
  margin-bottom: 8px;
  transition: color 0.3s ease;
  position: relative;
  z-index: 1;
}

ul.wp-block-latest-posts.posting-contents
  .wp-block-latest-posts__post-title:hover {
  color: #3b82f6 !important;
}

/* 7. 게시글 발췌 내용 */
ul.wp-block-latest-posts.posting-contents .wp-block-latest-posts__post-excerpt {
  font-size: 0.95rem !important;
  color: #6b7280 !important;
  line-height: 1.7 !important;
  padding: 0 30px;
  margin-bottom: 24px;
  flex-grow: 1;
  position: relative;
  z-index: 1;
}

E.o.D