css实现带图文的checkbox多选框美化效果代码

代码语言:html

所属分类:布局界面

代码描述:css实现带图文的checkbox多选框美化效果代码

代码标签: css 图文 checkbox 多选框 美化

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

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

<head>
  <meta charset="UTF-8">
  

  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Moderustic:wght@400&family=Playfair+Display:wght@600&display=swap");
* {
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #f9f1e8;
  font-family: "Moderustic", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

section {
  padding-block: min(20vh, 3.5rem);
  width: calc(min(70rem, 90%));
  margin-inline: auto;
  color: #111;
}
section h2 {
  letter-spacing: 0.025em;
  font-size: 2.6rem;
  line-height: 1.1;
  font-family: "Playfair Display", serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-style: normal;
}
@media screen and (min-width: 53rem) {
  section h2 {
    font-size: 3.2rem;
  }
}
section p {
  font-size: 1.1rem;
  color: #696969;
  margin-top: 0.8em;
  margin-left: 0.3em;
}
section a {
  display: inline-block;
  text-decoration: none;
}
section .container {
  margin-top: 4em;
  display: grid;
  gap: 2rem;
}
@media screen and (min-width: 40rem) {
  section .container {
    grid-template-columns: repeat(2, 1fr);
  }
}
section .container .card {
  padding: 0.625rem;
  background: #fff;
  border-radius: 1.2rem;
  overflow: hidden;
  cursor: pointer;
}
@media screen and (min-width: 53rem) {
  section .container .card {
    border-radius: 2rem;
  }
}
section .container .card:nth-child(1) .box .icon .iconBox {
  background: #d3b19a;
}
section .container .card:nth-child(2) .box .icon .iconBox {
  background: #70b3b1;
}
section .container .card:nth-child(3) .box .icon .iconBox {
  background: #d05fa2;
}
section .container .card-inner {
  position: relative;
  width: inherit;
  height: 12rem;
  background: var(--clr);
  border-bottom-right-radius: 0;
}
section .container .card-inner .box {
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 1.6rem;
  overflow: hidden;
}
section .container .card-inner .box .imgBox {
  position: absolute;
  inset: 0;
}
section .container .card-inner .box .imgBox img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1rem;
}
@media screen and (min-width: 53rem) {
  section .container .card-inner .box .imgBox img {
    border-radius: 1.6rem;
  }
}
section .container .card-inner .box .icon {
  position: absolute;
  bottom: -0.375rem;
  right: 0;
  width: 100%;
  height: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  pointer-events: none;
}
@media screen and (min-width: 53rem) {
  section .container .card-inner .box .icon {
    width: 18rem;
    border-top-left-radius: 1rem;
    right: -0.375rem;
  }
  section .container .card-inner .box .icon::before {
    position: absolute;
    content: "";
    bottom: 0.375rem;
    left: -1.25rem;
    background: transparent;
    width: 1.25rem;
    height: 1.25rem;
    border-bottom-right-radius: 1rem;
    box-shadow: 0.313rem 0.313rem 0 0.313rem #fff;
  }
  section .container .card-inner .box .icon::after {
    position: absolute;
    content: "";
    top: -1.25rem;
    right: 0.375rem;
    background: transparent;
    width: 1.25rem;
    height: 1.25rem;
    border-bottom-right-radius: 1.25rem;
    box-shadow: 0.313rem 0.313rem 0 0.313rem var(--clr);
  }
}
section .container .card-inner .box .icon:hover .iconBox {
  transform: scale(1.1);
}
section .container .card-inner .box .icon h3 {
  margin-left: 0.3em;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: #c8c8c8;
  font-weight: 400;
}
@media screen and (min-width: 53rem) {
  section .container .card-inner .box .icon h3 {
    margin-left: 1em;
  }
}
section .container .card-inner .box .icon .iconBox {
  position: absolute;
  inset: 0.625rem;
  background: #282828;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.3s;
}
section .container .card-inner .box .icon .iconBox span {
  color: #fff;
  font-size: 1.5rem;
}
section .container .card-inner .box .icon input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}
section .container .card-inner .box .icon .checkmark {
  position: absolute;
  top: 0.938rem;
  right: 1.25rem;
  height: 1.063rem;
  width: 1.063rem;
  background-color: transparent;
  border: 0.063rem solid #c8c8c8;
  border-radius: 0.438rem;
}
section .container .card-inner .box .icon .checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 0.........完整代码请登录后点击上方下载按钮下载查看

网友评论0