css布局实现自适应卡片悬浮图片渐变过渡效果代码

代码语言:html

所属分类:布局界面

代码描述:css布局实现自适应卡片悬浮图片渐变过渡效果代码

代码标签: 适应 卡片 悬浮 图片 渐变 过渡 效果

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


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
  
<style>
.card {
  --card-gradient: rgba(0, 0, 0, 0.8);
  --card-gradient: #5e9ad9, #e271ad;
  --card-blend-mode: overlay;
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0.05rem 0.1rem 0.3rem -0.03rem rgba(0, 0, 0, 0.45);
  padding-bottom: 1rem;
  background-image: linear-gradient(var(--card-gradient), white max(9.5rem, 27vh));
  overflow: hidden;
}
.card img {
  border-radius: 0.5rem 0.5rem 0 0;
  width: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  max-height: max(10rem, 30vh);
  aspect-ratio: 4/3;
  mix-blend-mode: var(--card-blend-mode);
}
.card img ~ * {
  margin-left: 1rem;
  margin-right: 1rem;
}
.card > :last-child {
  margin-bottom: 0;
}
.card:hover, .card:focus-within {
  --card-gradient: #24a9d5 max(8.5rem, 20vh);
}

/* Additional demo display styles */
* {
  box-sizing: border-box;
}

body {
  display: grid;
  place-content: center;
  justify-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 1rem;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, Ubuntu, roboto, noto, segoe ui, arial, sans-serif;
  color: #444;
  background-color: #e1faf1;
}

.card h3.........完整代码请登录后点击上方下载按钮下载查看

网友评论0