当前位置: 首页 > news >正文

关注用户信息卡片

效果展示

在这里插入图片描述

CSS 知识点

  • box-shadow 属性回顾
  • CSS 变量回顾

实现页面整体布局

<div class="card"><div class="box"><!-- 视频 --><div class="vide_box"><video src="user.mp4" type="video/mp4" autoplay loop muted></video></div></div><div class="box"><!-- 用户基本信息 --><div class="content"><h2>cat miao<br /><span>Professional Artist</span></h2><ul><li>文章<span>62</span></li><li>关注<span>122</span></li><li>点赞<span>32</span></li></ul><button>关注</button></div></div><!-- 用户头像 --><div class="circle"><div class="img_box"><img src="user.jpg" /></div></div>
</div>

实现页面整体样式

.card {position: relative;width: 320px;height: 430px;display: flex;flex-flow: column wrap;justify-content: space-between;
}.card .box {position: relative;width: 110%;height: 200px;border-radius: 15px;
}/* 实现卡片四周的圆角 */
.card .box:nth-child(1)::before {content: "";position: absolute;top: 108px;left: -1px;width: 20px;height: 20px;background: transparent;z-index: 10;border-bottom-left-radius: 18px;box-shadow: -6px 6px var(--clr);
}.card .box:nth-child(1)::after {content: "";position: absolute;bottom: -1px;left: 115px;width: 20px;height: 20px;background: transparent;z-index: 10;border-bottom-left-radius: 18px;box-shadow: -6px 6px var(--clr);
}.card .box:nth-child(2)::before {content: "";position: absolute;top: 92px;left: -1px;width: 20px;height: 20px;background: transparent;z-index: 10;border-top-left-radius: 16px;box-shadow: -8px -8px var(--clr);
}.card .box:nth-child(2)::after {content: "";position: absolute;top: -1px;left: 120px;width: 20px;height: 20px;background: transparent;z-index: 10;border-top-left-radius: 16px;box-shadow: -8px -8px var(--clr);
}

完成用户头像和视频部分样式

.card .circle .img_box,
.card .box .vide_box {width: 100%;height: 100%;overflow: hidden;border-radius: 50%;
}.card .box .vide_box {border-radius: 15px;
}.card .circle .img_box img,
.card .box .vide_box video {width: 100%;height: 100%;object-fit: cover;
}

完成用户基本数据部分样式

这里只是展示部分代码。

.card .box .content {position: absolute;inset: 0;display: flex;flex-direction: column;gap: 15px;padding: 30px 10px 20px;align-items: center;
}.card .box .content h2 {width: 100%;padding-left: 120px;text-transform: uppercase;font-size: 1.15em;letter-spacing: 0.1em;font-weight: 600;line-height: 1.1em;color: #333;
}.card .box .content ul {position: relative;top: 15px;display: grid;grid-template-columns: repeat(3, 1fr);width: 100%;padding: 0 10px;justify-content: space-evenly;
}.card .box .content ul li {list-style: none;display: flex;flex-direction: column;text-align: center;padding: 0 10px;font-size: 0.85em;font-weight: 500;color: #999;
}.card .box .content ul li:not(:last-child) {border-right: 1px solid #ccc;
}

实现关注按钮样式

.card .box .content button {position: relative;top: 40px;padding: 8px 30px;border: none;outline: none;background: #03a9f4;border-radius: 30px;color: #fff;font-size: 1em;letter-spacing: 0.2em;text-transform: uppercase;font-weight: 500;cursor: pointer;border: 5px solid var(--clr);box-shadow: 0 0 0 10px #fff;transition: 0.5s;
}.card .box .content button:hover {letter-spacing: 0.5em;background: #ff3d7f;
}.card .box .content button::before {content: "";position: absolute;top: 17px;left: -31px;width: 20px;height: 20px;background: transparent;border-top-right-radius: 24px;box-shadow: 5px -7px #fff;
}.card .box .content button::after {content: "";position: absolute;top: 16px;right: -32px;width: 20px;height: 20px;background: transparent;border-top-left-radius: 24px;box-shadow: -5px -7px #fff;
}

完整代码下载

完整代码下载

http://www.lryc.cn/news/196263.html

相关文章:

  • 【Java基础面试十八】、说一说重写与重载的区别
  • Linux文件管理(上)
  • docker 复习
  • React之事件机制与事件绑定
  • spark stream入门案例:netcat准实时处理wordCount(scala 编程)
  • Ansible基础及模块
  • Atlassian Confluence OGNL表达式注入RCE CVE-2021-26084
  • 【c语言】编译链接--详解
  • 国家开放大学 训练题
  • 【灵动 Mini-G0001开发板】+Keil5开发环境搭建+ST-Link/V2程序下载和仿真+4颗LED100ms闪烁。
  • 同为科技(TOWE)关于风力发电雷电防护的解决方案
  • gorm 中的事务运用
  • maven 新建模块 导入后 按Ctrl 点不进新建模块pom定义
  • idea使用debug无法启动,使用run可以启动
  • 进程的虚拟地址空间
  • 做web自动化测试遇到Chrome浏览器老是自动更新,怎么办 ? 这里提供两个解决办法 。
  • 腾讯HR面试
  • 过滤器(Filter)和拦截器(Interceptor)有什么不同?
  • Spring 注解 @Qualifier 详解
  • 实现更低功耗R5F51406BDNE、R5F51406ADFK、R5F51406ADFL、R5F51406AGFN搭载RXv2内核的32位微控制器
  • 通信系统中ZF,ML,MRC以及MMSE四种信号检测算法误码率matlab对比仿真
  • Redis数据结构之listpack
  • VMware 配置记录
  • 【Java基础面试十四】、 封装的目的是什么,为什么要有封装?
  • 阿里云2023年双十一优惠活动整理
  • HTML标签详解 HTML5+CSS3+移动web 前端开发入门笔记(四)
  • lenovo联想笔记本ThinkPad系列T15p或P15v Gen3(21DA,21DB,21D8,21D9)原厂Win11系统镜像
  • 【SpringBoot】拦截器(Interceptor)的使用
  • CS鱼饵制作
  • 问题记录1 json解析问题